more piping fixes for multiple commands

This commit is contained in:
Anthony Scopatz 2016-10-26 20:51:28 -04:00
parent 3a724d93f3
commit 400ef828d9
3 changed files with 9 additions and 1 deletions

View file

@ -52,5 +52,6 @@
if previous commands have executed successfully. This is helpful
for pipelines where the last command takes a long time to start up,
such as GNU Parallel. This also checks to make sure that output has occured.
This includes piping 2+ commands together.
**Security:** None

View file

@ -139,6 +139,13 @@ with open('tttt', 'w') as fp:
![cat tttt | wc]
""", ' 1 2 10\n' if ON_WINDOWS else " 1 2 9 <stdin>\n", 0),
# test double piping 'real' command
("""
with open('tttt', 'w') as fp:
fp.write("Wow mom!\\n")
![cat tttt | wc | wc]
""", ' 1 4 24\n' if ON_WINDOWS else " 1 4 16 <stdin>\n", 0),
]

View file

@ -1513,7 +1513,7 @@ class CommandPipeline:
elif prev_end_time is None:
# or see if we already know that the next-to-last
# proc in teh pipeline has ended.
if self.procs[-2].poll() is not None:
if self._prev_procs_done():
# if it has, record the time
prev_end_time = time.time()
elif time.time() - prev_end_time >= 0.1: