commit bc3cce45596102921fb4d7b19203b54863550ff3
parent a91290f045a72de724941526ce60db634a05b85e
Author: AMIT DUTTA <amitdutta4255@gmail.com>
Date: Sun, 11 Jan 2026 18:52:05 +0530
Refactor backend.py for improved functionality
Diffstat:
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/backend.py b/backend.py
@@ -4,7 +4,6 @@ import json
import subprocess
import os
import sys
-import platform
import threading
import re
import importlib.util
@@ -73,6 +72,14 @@ async def handle_client(request):
ws.send_json({'type': 'stdout', 'data': char}),
loop
)
+
+ # --- SIGNAL FINISH ---
+ # When stream ends (process exits), tell frontend
+ asyncio.run_coroutine_threadsafe(
+ ws.send_json({'type': 'status', 'msg': 'Program finished'}),
+ loop
+ )
+
except Exception:
pass