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 markon
Recipients ezio.melotti, markon, milko.krachounov
Date 2009-10-15.15:04:32
SpamBayes Score 3.571936e-10
Marked as misclassified No
Message-id <1255619076.52.0.644761242296.issue6973@psf.upfronthosting.co.za>
In-reply-to
Content
I agree with Milko. 

However, I think Popen.send_signal should poll() before sending any
signals, without resetting any variables to zero (or None).
In this way, if you poll() before sending a signal, if the return code
is None, the child is still running. If the poll return code is
different than None, the child has been terminated, so you must not send
anything to the child process.

In this way, instead of polling before sending signals to check if the
child has been terminated, we can make Python do the work for us.

I've provided a patch. All the tests pass.
A new test has been added: test_terminate_already_terminated_child.
This method asserts `terminate()` (through `send_signal`) raises an
OSError exception. 

However, even though you try the old version of subprocess.py all the
tests pass. This happens because the method `send_signal` calls
os.kill() (or Terminate for Windows systems) that can raise an OSError
exception if the process to which it send the signal does not exist. 
`send_signal` has been fixed to be a safer method, so that it raises an
OSError exception if the child has been terminated.
History
Date User Action Args
2009-10-15 15:04:37markonsetrecipients: + markon, ezio.melotti, milko.krachounov
2009-10-15 15:04:36markonsetmessageid: <1255619076.52.0.644761242296.issue6973@psf.upfronthosting.co.za>
2009-10-15 15:04:35markonlinkissue6973 messages
2009-10-15 15:04:33markoncreate