From 9a53e36aded1e7dff6d3aaef5770a56917a03309 Mon Sep 17 00:00:00 2001 From: Kevin Van Brunt Date: Sun, 17 Nov 2019 03:35:45 -0500 Subject: Fixed ProcessLookupError --- cmd2/utils.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'cmd2/utils.py') 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""" -- cgit v1.2.1