Author markon
Recipients ezio.melotti, markon, milko.krachounov
Date 2009-10-15.15:04:32
SpamBayes Score 3.57194e-10
Marked as misclassified No
Message-id <>
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 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.
Date User Action Args
2009-10-15 15:04:37markonsetrecipients: + markon, ezio.melotti, milko.krachounov
2009-10-15 15:04:36markonsetmessageid: <>
2009-10-15 15:04:35markonlinkissue6973 messages
2009-10-15 15:04:33markoncreate