From 6b2c5b7e392226f36ecc79de766710697fcdcac2 Mon Sep 17 00:00:00 2001 From: Sei Lisa Date: Mon, 17 Aug 2015 04:56:32 +0200 Subject: [PATCH] Fix preprocessor piping. Found by SungAli, diagnosed by SungAli and Sei Lisa. --- main.py | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index 7084804..c860586 100755 --- a/main.py +++ b/main.py @@ -469,14 +469,8 @@ def main(): stdout = '' p = subprocess.Popen(preproc_cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE) - p.stdin.write(script) - p.stdin.close() - while True: - time.sleep(0.1) - status = p.poll() - stdout += p.stdout.read() - if status is not None: - break + stdout = p.communicate(input=script)[0] + status = p.wait() if status: return status script = stdout