mirror of
https://github.com/xonsh/xonsh.git
synced 2025-03-05 17:00:58 +01:00
Fixed process hanging issue.
This commit is contained in:
parent
ad494b1876
commit
cc468d499e
2 changed files with 19 additions and 3 deletions
14
news/checkend.rst
Normal file
14
news/checkend.rst
Normal file
|
@ -0,0 +1,14 @@
|
|||
**Added:** None
|
||||
|
||||
**Changed:** None
|
||||
|
||||
**Deprecated:** None
|
||||
|
||||
**Removed:** None
|
||||
|
||||
**Fixed:**
|
||||
|
||||
* Fixed hanging issue with pipelines whose middle processes exit before the
|
||||
first or last process.
|
||||
|
||||
**Security:** None
|
|
@ -2062,16 +2062,18 @@ class CommandPipeline:
|
|||
"""Boolean for if all previous processes have completed. If there
|
||||
is only a single process in the pipeline, this returns False.
|
||||
"""
|
||||
any_running = False
|
||||
for s, p in zip(self.specs[:-1], self.procs[:-1]):
|
||||
if p.poll() is None:
|
||||
any_running = True
|
||||
continue
|
||||
self._safe_close(p.stdin)
|
||||
self._safe_close(s.stdin)
|
||||
if p.poll() is None:
|
||||
return False
|
||||
self._safe_close(p.stdout)
|
||||
self._safe_close(s.stdout)
|
||||
self._safe_close(p.stderr)
|
||||
self._safe_close(s.stderr)
|
||||
return len(self) > 1
|
||||
return False if any_running else (len(self) > 1)
|
||||
|
||||
def _close_prev_procs(self):
|
||||
"""Closes all but the last proc's stdout."""
|
||||
|
|
Loading…
Add table
Reference in a new issue