Skip to content

Commit

Permalink
run_command: Fix possible deadlock
Browse files Browse the repository at this point in the history
- 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 jupyterhub#90.
  • Loading branch information
rkdarst committed Jul 31, 2018
1 parent c320f05 commit a23b3d4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions batchspawner/batchspawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,8 @@ def run_command(self, cmd, input=None, env=None):
# Apparently harmless
pass
proc.stdin.close()
out = yield proc.stdout.read_until_close()
eout = yield proc.stderr.read_until_close()
out, eout = yield [proc.stdout.read_until_close(),
proc.stderr.read_until_close()]
proc.stdout.close()
proc.stderr.close()
eout = eout.decode().strip()
Expand Down

0 comments on commit a23b3d4

Please sign in to comment.