From b28c8bf611b48a411886646beecd866e912b7cf5 Mon Sep 17 00:00:00 2001 From: Folkert van Heusden Date: Thu, 3 Apr 2025 21:55:23 +0200 Subject: [PATCH] hangs often --- run-json.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/run-json.py b/run-json.py index 38789e7..3e95685 100755 --- a/run-json.py +++ b/run-json.py @@ -1,18 +1,19 @@ #! /usr/bin/python3 import json -from subprocess import Popen, PIPE +from subprocess import Popen, PIPE, STDOUT import sys -debug = False +debug = True def docmd(p, str): - p.stdin.write((str + "\n").encode('ascii')) + print(f'SEND {str}') + p.stdin.write(str + "\n") + p.stdin.flush() pl = None while True: - line = p.stdout.readline() - line = line.decode('ascii', 'ignore').rstrip('\n').strip('\r') + line = p.stdout.readline().rstrip('\n').rstrip('\r') if debug: print(f'|{line}|') @@ -21,7 +22,7 @@ def docmd(p, str): pl = line -process = Popen(['./build/kek', '-d', '-L', 'emergency,debug', '-t', '-l', sys.argv[2]], stdin=PIPE, stdout=PIPE, stderr=PIPE, bufsize=0) +process = Popen(['./build/kek', '-d', '-L', 'emergency,debug', '-l', sys.argv[2]], stdin=PIPE, stdout=PIPE, stderr=STDOUT, close_fds=True, bufsize=1, universal_newlines=True, text=True) docmd(process, 'marker') test_file = sys.argv[1]