Skip to content

Commit

Permalink
bugfix: the left-hand-side process of a pipe wasn't waited on, leadin…
Browse files Browse the repository at this point in the history
…g to zombies. closes #89
  • Loading branch information
tomerfiliba committed Sep 6, 2013
1 parent 1c6a87d commit 40618e7
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion plumbum/commands/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
from plumbum.commands.processes import run_proc
from plumbum.lib import bytes
from tempfile import TemporaryFile
from subprocess import PIPE
from subprocess import PIPE, Popen
import functools


class RedirectionError(Exception):
Expand Down Expand Up @@ -280,6 +281,14 @@ def popen(self, args = (), **kwargs):
if srcproc.stdin:
srcproc.stdin.close()
dstproc.srcproc = srcproc

dstproc_wait = dstproc.wait
@functools.wraps(Popen.wait)
def wait2():
rc = dstproc_wait()
srcproc.wait()
return rc
dstproc.wait = wait2
return dstproc

class BaseRedirection(BaseCommand):
Expand Down

0 comments on commit 40618e7

Please sign in to comment.