This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author techtonik
Recipients techtonik
Date 2013-09-29.10:46:41
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1380451602.11.0.517013085188.issue19124@psf.upfronthosting.co.za>
In-reply-to
Content
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
History
Date User Action Args
2013-09-29 10:46:42techtoniksetrecipients: + techtonik
2013-09-29 10:46:42techtoniksetmessageid: <1380451602.11.0.517013085188.issue19124@psf.upfronthosting.co.za>
2013-09-29 10:46:42techtoniklinkissue19124 messages
2013-09-29 10:46:41techtonikcreate