From 9242fa98d031f4075a450bc41beaada9ea1d270d Mon Sep 17 00:00:00 2001 From: lixin Date: Thu, 15 Aug 2024 14:33:52 +0800 Subject: [PATCH] fix(): Update surfServer.py to fi deadlock caused by buffer is full Use communicate() to read stdout and stderr in non-blocking way. Fix deadlock caused by buffer is full in some situations. --- compile/remote-compile/lbc/tool/surfServer.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/compile/remote-compile/lbc/tool/surfServer.py b/compile/remote-compile/lbc/tool/surfServer.py index c91ebf5..454b7d1 100644 --- a/compile/remote-compile/lbc/tool/surfServer.py +++ b/compile/remote-compile/lbc/tool/surfServer.py @@ -65,7 +65,9 @@ def __init__(self): def cmd(self, cmds): p = Popen(shlex.split(cmds), stdout=PIPE, stderr=PIPE) - return p.stdout.read().decode() + p.stderr.read().decode() + # return p.stdout.read().decode() + p.stderr.read().decode() + stdout, stderr = p.communicate() + return stdout.decode() + stderr.decode() def system(self, cmds): cmds = cmds.replace('\0', '').strip()