[issue40550] Popen.terminate fails with ProcessLookupError under certain conditions
Alexander Overvoorde
report at bugs.python.org
Fri May 8 16:53:32 EDT 2020
Alexander Overvoorde <overv161 at gmail.com> added the comment:
I'm not sure that it is expected since Popen.send_signal does contain the following check:
```
def send_signal(self, sig):
"""Send a signal to the process."""
# Skip signalling a process that we know has already died.
if self.returncode is None:
os.kill(self.pid, sig)
```
Additionally, the following program does not raise a ProcessLookupError despite the program already having exited:
```
import subprocess
import time
proc = subprocess.Popen(["sh", "-c", "exit 0"])
time.sleep(5)
proc.terminate()
```
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40550>
_______________________________________
More information about the Python-bugs-list
mailing list