Author siona
Recipients siona
Date 2013-02-05.09:54:58
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1360058099.4.0.320628892834.issue17131@psf.upfronthosting.co.za>
In-reply-to
Content
Compare this with the script in #14252:

p = Popen(['/bin/sleep', '1'])
time.sleep(1)
p.terminate()
print p.poll()
p.terminate()

Output is:

0
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/subprocess.py", line 1269, in terminate
    self.send_signal(signal.SIGTERM)
  File "/usr/lib/python2.6/subprocess.py", line 1264, in send_signal
    os.kill(self.pid, sig)
OSError: [Errno 3] No such process

The 0 return from poll() indicates that the subprocess ran to completion, rather than being terminated by the first terminate. So the first terminate does nothing, but the second terminate raises an exception. In http://bugs.python.org/issue14252#msg155396 :

"Raising an exception on terminate is a bug."
History
Date User Action Args
2013-02-05 09:54:59sionasetrecipients: + siona
2013-02-05 09:54:59sionasetmessageid: <1360058099.4.0.320628892834.issue17131@psf.upfronthosting.co.za>
2013-02-05 09:54:59sionalinkissue17131 messages
2013-02-05 09:54:58sionacreate