Message198578
os.execv() starts process in background on Windows. Because it inherits stdin/stdout handlers from the process that launched Python interpreter, this becomes a source of numerous weird bugs, from polluting the stdout stream of parent to completely blocking its input.
Example session on Windows. Open cmd.exe and run attached testexecvchild.py. It starts child process with execv(). Child pauses for 2 seconds during which I type 'echo "Hello"' and hit Enter.
With Python 3 is pollutes parent output after 3 seconds:
>python testexecvchild.py
>echo "Hello"
"Hello"
>Traceback (most recent call last):
File "testexecvchild.py", line 7, in <module>
raw_input('xxx')
NameError: name 'raw_input' is not defined
With Python 2 the stdin of cmd.exe is blocked:
>py testexecvchild.py
>echo "Hello"
"Hello"
>xxxecho "Hello"
"Hello"
>echo "Hello"
testexecvchild.py
passed
echo "Hello"
"Hello"
The same behavior on Linux:
$ python testexecvchild.py
echo "Hello"
xxx testexecvchild.py
passed |
|
Date |
User |
Action |
Args |
2013-09-29 10:46:42 | techtonik | set | recipients:
+ techtonik |
2013-09-29 10:46:42 | techtonik | set | messageid: <1380451602.11.0.517013085188.issue19124@psf.upfronthosting.co.za> |
2013-09-29 10:46:42 | techtonik | link | issue19124 messages |
2013-09-29 10:46:41 | techtonik | create | |
|