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 11:24:32 -0400 |
commit | b54f7116eeed7926f54ed50592ec5fdeb01a4c25 (patch) | |
tree | eaa0baa52e2756af740c2b2ce995708df54817c7 /cmd2/utils.py | |
parent | 9dc01864df378ae128d0292e7f18e6b5e81765c4 (diff) | |
download | cmd2-git-ctrl-c.tar.gz |
Stopping a shell command with Ctrl-C now raises a KeyboardInterrupt to support stopping a text script which ran the shell command.ctrl-c
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 |