From 43058cbd15de15698c58795e295c1b48b0377645 Mon Sep 17 00:00:00 2001 From: Xe Iaso Date: Mon, 9 May 2022 18:34:50 +0000 Subject: [PATCH] synchronously log Signed-off-by: Xe Iaso --- main.py | 7 +++++-- main_view.html | 18 ++++++++---------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/main.py b/main.py index 2dc05d2..38cc115 100644 --- a/main.py +++ b/main.py @@ -2,10 +2,12 @@ import json import os import pathlib import subprocess +import sys class Plugin: async def log(self, message=""): print("frontend: " + message) + sys.stdout.flush() async def whoami(self, *args): return os.getuid() @@ -30,8 +32,9 @@ class Plugin: return "impossible state" async def install_state(self, *args): - result = await self.install_state() - print("status: " + result) + await self.log("fetching state") + result = self.install_state() + await self.log("status: " + result) return result # Asyncio-compatible long-running code, executed in a task when the plugin is loaded diff --git a/main_view.html b/main_view.html index f20bafe..0102e36 100644 --- a/main_view.html +++ b/main_view.html @@ -5,29 +5,27 @@