diff options
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r-- | cmd2/cmd2.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 0aaeb4c3..dd93a73e 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -2940,8 +2940,11 @@ class Cmd(cmd.Cmd): tokens[index] = first_char + tokens[index] + first_char expanded_command = ' '.join(tokens) - proc = subprocess.Popen(expanded_command, stdout=self.stdout, shell=True) - proc.communicate() + + # Use pipes for stdout and stderr so they can be captured by our process + proc = subprocess.Popen(expanded_command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True) + proc_reader = utils.ProcReader(proc, self.stdout, sys.stderr) + proc_reader.wait() @staticmethod def _reset_py_display() -> None: |