diff options
author | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-11-17 03:35:45 -0500 |
---|---|---|
committer | Kevin Van Brunt <kmvanbrunt@gmail.com> | 2019-11-17 03:35:45 -0500 |
commit | 9a53e36aded1e7dff6d3aaef5770a56917a03309 (patch) | |
tree | d629d9990d405b2183d842b9a316b2ab0aebe878 | |
parent | d0ba1d56858ac280050e57a02913dbd8540095b9 (diff) | |
download | cmd2-git-9a53e36aded1e7dff6d3aaef5770a56917a03309.tar.gz |
Fixed ProcessLookupError
-rw-r--r-- | cmd2/utils.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/cmd2/utils.py b/cmd2/utils.py index e3d54ffe..3155c64a 100644 --- a/cmd2/utils.py +++ b/cmd2/utils.py @@ -524,7 +524,11 @@ class ProcReader(object): else: # Since cmd2 uses shell=True in its Popen calls, we need to send the SIGINT to # the whole process group to make sure it propagates further than the shell - os.killpg(os.getpgid(self._proc.pid), signal.SIGINT) + try: + group_id = os.getpgid(self._proc.pid) + os.killpg(group_id, signal.SIGINT) + except ProcessLookupError: + return def terminate(self) -> None: """Terminate the process""" |