diff --git a/Lib/subprocess.py b/Lib/subprocess.py index 2044d2a42897e9..1948ac8a3a1dfe 100644 --- a/Lib/subprocess.py +++ b/Lib/subprocess.py @@ -1123,10 +1123,9 @@ def __exit__(self, exc_type, value, traceback): except TimeoutExpired: pass self._sigint_wait_secs = 0 # Note that this has been done. - return # resume the KeyboardInterrupt - - # Wait for the process to terminate, to avoid zombies. - self.wait() + else: + # Wait for the process to terminate, to avoid zombies. + self.wait() def __del__(self, _maxsize=sys.maxsize, _warn=warnings.warn): if not self._child_created: