From 05baceb388d881e37b3c37823fc3ef19795ac490 Mon Sep 17 00:00:00 2001 From: Cole Deck Date: Tue, 6 Aug 2024 17:36:31 -0500 Subject: [PATCH] Fix logic --- run.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/run.py b/run.py index 8cfccb0..850e7c2 100755 --- a/run.py +++ b/run.py @@ -1121,6 +1121,8 @@ def setup_client(pool): fprint("Running full jukebox control system...") jb = subprocess.Popen("ssh root@192.168.1.25 -t -- /root/jukebox-software/run.sh".split(' '), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, bufsize=1, universal_newlines=True) while True: + if jb.poll() is not None: + break line = jb.stdout.readline() # Alternatively proc.stdout.read(1024) if len(line) == 0: # program end break @@ -1142,15 +1144,22 @@ def setup_client(pool): firefox.get('http://192.168.1.25:3000') global kill_ssh - for line in jb.stdout: + while True: + if jb.poll() is not None: + break + line = jb.stdout.readline() # Alternatively proc.stdout.read(1024) + if len(line) == 0: # program end + break print(line, end='') if kill_ssh is True: break firefox.close() + jb.terminate() #run_cmd("Stop-VM -Name Jukebox*") + sleep(2) killall() #firefox.execute_script('document.body.style.MozTransform = "scale(0.80)";')