Is it possible for Popen.communicate(timeout=2)
to raise TimeoutExpired
, even though I am asserting that Popen.poll() is not None
and Popen.wait(2)
does not throw an exception?
Edit: The docs suggest to use the following snippet:
proc = subprocess.Popen(...)
try:
outs, errs = proc.communicate(timeout=15)
except TimeoutExpired:
proc.kill()
outs, errs = proc.communicate()
but this will just raise ProcessLookupError: [Errno 3] No such process
. Which makes sense because I've already terminated the process via poll
and wait
.