Message250723
On windows and python up to 3.4 using the combination of os.spawnX(os.P_NOWAIT, ...) and os.waitpid() worked as expected, but with python 3.5 this no longer works. In fact os.waitpid() now raises an OSError when the child process terminates.
Running this simple script demonstrates that:
import sys
import os
import time
print(sys.version)
file = r'c:\windows\system32\cmd.exe'
args = [file, '/C', 'ping', '1.1.1.1', '-n', '1', '>NUL']
env = os.environ
t0 = time.time()
ret = os.spawnve(os.P_NOWAIT, file, args, env)
pid, status = os.waitpid(ret, 0)
t1 = time.time()
print("process took %.1f seconds" % (t1 - t0))
I get the following outputs:
C:\Users\rmatano\test_py35>py -3.4 test_waitpid.py
3.4.0 (v3.4.0:04f714765c13, Mar 16 2014, 19:25:23) [MSC v.1600 64 bit (AMD64)]
process took 3.6 seconds
C:\Users\rmatano\test_py35>py -3.5 test_waitpid.py
3.5.0 (v3.5.0:374f501f4567, Sep 13 2015, 02:27:37) [MSC v.1900 64 bit (AMD64)]
Traceback (most recent call last):
File "twp.py", line 13, in <module>
pid, status = os.waitpid(ret, 0)
OSError: [Errno 0] Error
I guess this is a bug rather than a intended change in behavior, isn't it? |
|
Date |
User |
Action |
Args |
2015-09-15 05:52:11 | rocco.matano | set | recipients:
+ rocco.matano |
2015-09-15 05:52:11 | rocco.matano | set | messageid: <1442296331.17.0.794192242028.issue25118@psf.upfronthosting.co.za> |
2015-09-15 05:52:11 | rocco.matano | link | issue25118 messages |
2015-09-15 05:52:09 | rocco.matano | create | |
|