New submission from S Arrowsmith:
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."
----------
components: Library (Lib)
messages: 181425
nosy: siona
priority: normal
severity: normal
status: open
title: subprocess.Popen.terminate can raise exception on Posix
type: behavior
versions: Python 2.6, Python 2.7, Python 3.2
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue17131>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com