diff options
| author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-04-28 15:07:26 -0400 |
|---|---|---|
| committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2021-04-30 13:12:23 -0400 |
| commit | 37d415b4bbfd6efd383a20062df68f627451ccf7 (patch) | |
| tree | f3b12ec9739e276fec87f3224c6f0aafbbc291df /cmd2/utils.py | |
| parent | 329a2e23bcc65e214e9775bbe995946c407c9629 (diff) | |
| download | cmd2-git-37d415b4bbfd6efd383a20062df68f627451ccf7.tar.gz | |
Stopping a shell command with Ctrl-C now raises a KeyboardInterrupt to support stopping a text script which ran the shell command.
On POSIX systems, shell commands and processes being piped to are now run in the user's preferred shell instead of /bin/sh.
Diffstat (limited to 'cmd2/utils.py')
| -rw-r--r-- | cmd2/utils.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py index bb3d1a65..cbbd1800 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -601,8 +601,8 @@ class ProcReader: import signal if sys.platform.startswith('win'): - # cmd2 started the Windows process in a new process group. Therefore - # a CTRL_C_EVENT can't be sent to it. Send a CTRL_BREAK_EVENT instead. + # cmd2 started the Windows process in a new process group. Therefore we must send + # a CTRL_BREAK_EVENT since CTRL_C_EVENT signals cannot be generated for process groups. self._proc.send_signal(signal.CTRL_BREAK_EVENT) else: # Since cmd2 uses shell=True in its Popen calls, we need to send the SIGINT to |
