Marco Buccini <marcu...@gmail.com> added the comment: 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. ---------- keywords: +patch nosy: +markon Added file: http://bugs.python.org/file15135/subprocess.patch _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue6973> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com