New submission from anatoly techtonik:
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
----------
components: Library (Lib)
messages: 198578
nosy: techtonik
priority: normal
severity: normal
status: open
title: os.execv executes in background on Windows
type: behavior
versions: Python 2.7, Python 3.3
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19124>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com