Skip to content

Commit a23b3d4

Browse files
committed
run_command: Fix possible deadlock
- Reading from stdout and stderr separately can produce a deadlock. I assume that the separate proc.wait_for_exit() doesn't matter here. - Thanks to @krinsman in #90.
1 parent c320f05 commit a23b3d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

batchspawner/batchspawner.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ def run_command(self, cmd, input=None, env=None):
189189
# Apparently harmless
190190
pass
191191
proc.stdin.close()
192-
out = yield proc.stdout.read_until_close()
193-
eout = yield proc.stderr.read_until_close()
192+
out, eout = yield [proc.stdout.read_until_close(),
193+
proc.stderr.read_until_close()]
194194
proc.stdout.close()
195195
proc.stderr.close()
196196
eout = eout.decode().strip()

0 commit comments

Comments
 (0)