diff options
Diffstat (limited to 'cmd2/utils.py')
-rw-r--r-- | cmd2/utils.py | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py index 5bb08edd..4172e362 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -414,19 +414,14 @@ class ProcReader(object): def wait(self) -> None: """Wait for the process to finish""" - while True: - try: - if self._out_thread.is_alive(): - self._out_thread.join() - if self._err_thread.is_alive(): - self._err_thread.join() - - # Handle case where the process ended before the last read could be done. - # This will return None for the streams that weren't pipes. - out, err = self._proc.communicate() - break - except KeyboardInterrupt: - pass + if self._out_thread.is_alive(): + self._out_thread.join() + if self._err_thread.is_alive(): + self._err_thread.join() + + # Handle case where the process ended before the last read could be done. + # This will return None for the streams that weren't pipes. + out, err = self._proc.communicate() if out: self._write_bytes(self._stdout, out) |