[issue34233] subprocess.check_output goes to infinte loop

Eryk Sun report at bugs.python.org
Thu Jul 26 07:30:01 EDT 2018


Eryk Sun <eryksun at gmail.com> added the comment:

`cmd.exe dir` ignores the unrecognized `dir` argument and runs the interactive shell. The shell is waiting for input on stdin. You can type "exit" and press enter to return to Python.  

When you run this from IDLE (i.e. via pythonw.exe), there's no StandardInput handle to inherit, so subprocess executes cmd.exe with its stdin set to a closed pipe. (I don't know why a closed pipe is used. I think "NUL" would be better.) The shell exits immediately because ReadFile fails with ERROR_BROKEN_PIPE.

----------
nosy: +eryksun
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue34233>
_______________________________________


More information about the Python-bugs-list mailing list