This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author vstinner
Recipients giampaolo.rodola, vstinner
Date 2019-02-21.16:11:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1550765462.46.0.530162425872.issue36067@roundup.psfhosted.org>
In-reply-to
Content
I'm not sure of the purpose of this issue.


It's expected to get an error if you try to send a signal to process which is already terminated.

vstinner@apu$ python3
Python 3.7.2 (default, Jan 16 2019, 19:49:22) 
>>> import subprocess
>>> proc=subprocess.Popen("/bin/true")
>>> import os
>>> os.waitpid(proc.pid, 0)
(8171, 0)
>>> proc.kill()
ProcessLookupError: [Errno 3] No such process
>>> proc.terminate()
ProcessLookupError: [Errno 3] No such process

Ignoring these errors would be very risky: if another process gets the same pid, you would send a signal to the wrong process. Ooops.


If you only use the subprocess API, you don't have this issue:

vstinner@apu$ python3
Python 3.7.2 (default, Jan 16 2019, 19:49:22) 
>>> import subprocess
>>> proc=subprocess.Popen("/bin/true")
>>> proc.wait()
0
>>> proc.kill() # do nothing
>>> proc.terminate() # do nothing
History
Date User Action Args
2019-02-21 16:11:02vstinnersetrecipients: + vstinner, giampaolo.rodola
2019-02-21 16:11:02vstinnersetmessageid: <1550765462.46.0.530162425872.issue36067@roundup.psfhosted.org>
2019-02-21 16:11:02vstinnerlinkissue36067 messages
2019-02-21 16:11:02vstinnercreate