[New-bugs-announce] [issue25492] subprocess with redirection fails after FreeConsole

George Prekas report at bugs.python.org
Tue Oct 27 11:33:14 EDT 2015


New submission from George Prekas:

Under Windows, if I do FreeConsole and then subprocess.call with redirected stdin or stdout or stderr, then subprocess.call fails. The only solution is either DO NOT redirect any handle OR to redirect ALL of them. The problem lies in function _get_handles at subprocess.py:810 (Python 2.7.10), which does:
* GetStdHandle
* DuplicateHandle via _make_inheritable.

DuplicateHandle fails if called on stdin, stdout or stderr after FreeConsole.

$ cygstart /mnt/c/utils/Python35/python.exe testcase.py fails
$ cygstart /mnt/c/utils/Python35/python.exe testcase.py works1
$ cygstart /mnt/c/utils/Python35/python.exe testcase.py works2
$ cygstart /mnt/c/utils/Python35/python.exe testcase.py works3

----------
components: Library (Lib)
files: testcase.py
messages: 253547
nosy: George Prekas
priority: normal
severity: normal
status: open
title: subprocess with redirection fails after FreeConsole
type: behavior
versions: Python 2.7, Python 3.5
Added file: http://bugs.python.org/file40868/testcase.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25492>
_______________________________________


More information about the New-bugs-announce mailing list