Fix stdout flush

This commit is contained in:
Cole Deck 2024-08-06 17:16:20 -05:00
parent f8507a1bc9
commit c89fc86812

8
run.py
View File

@ -1120,7 +1120,7 @@ def setup_client(pool):
# Windows client setup # Windows client setup
from subprocess import PIPE from subprocess import PIPE
fprint("Running full jukebox control system...") fprint("Running full jukebox control system...")
jb = subprocess.Popen("ssh root@192.168.1.25 -- /root/jukebox-software/run.sh".split(' '), stdout=PIPE, stderr=PIPE) jb = subprocess.Popen("ssh root@192.168.1.25 -- /root/jukebox-software/run.sh".split(' '), stdout=PIPE, stderr=PIPE, bufsize=1, universal_newlines=True)
for line in jb.stdout: for line in jb.stdout:
print(line, end='') print(line, end='')
if line.find("Running mode: Idle") > 0: if line.find("Running mode: Idle") > 0:
@ -1138,8 +1138,10 @@ def setup_client(pool):
firefox.get('http://192.168.1.25:3000') firefox.get('http://192.168.1.25:3000')
global kill_ssh global kill_ssh
while kill_ssh is False: for line in jb.stdout:
sleep(0.1) print(line, end='')
if kill_ssh is True:
break
firefox.close() firefox.close()
jb.terminate() jb.terminate()