Eryk Sun <[email protected]> added the comment:
The documentation states that "[i]f capture_output is true, stdout and stderr
will be captured". This implies a container of some kind. So look to what
subprocess.run() returns: "[w]ait for command to complete, then return a
CompletedProcess instance". The `stdout` attribute of a CompletedProcess is the
"[c]aptured stdout from the child process".
For example:
>>> p = subprocess.run("dir", shell=True, capture_output=True)
>>> p.stdout[:18]
b' Volume in drive C'
If the output is not captured, the child process inherits the standard
output/error files of the parent process, which is typically a console or
terminal.
FYI, the `dir` command is internal to the CMD shell in Windows, so it only
works with shell=True. There is no "dir.exe" executable that can be executed
with shell=False.
----------
nosy: +eryksun
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45048>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com