New submission from DragonEggBedrockBreaking <cuber3mill...@gmail.com>:

If you run subprocess.run(capture_output=True), it doesn't show output, but if 
you run subprocess.run(capture_output=False) (or if you just run 
subprocess.run() since False is default), it does show output. In the example 
in the docs, it shows this in the examples section:

```py
>>> subprocess.run(["ls", "-l"])  # doesn't capture output
CompletedProcess(args=['ls', '-l'], returncode=0)

>>> subprocess.run(["ls", "-l", "/dev/null"], capture_output=True)
CompletedProcess(args=['ls', '-l', '/dev/null'], returncode=0,
stdout=b'crw-rw-rw- 1 root root 1, 3 Jan 23 16:23 /dev/null\n', stderr=b'')
```

This clearly shows capture_output showing output if true but not if false. Test 
code:

```py
import subprocess
subprocess.run("dir", shell=True, capture_output=False)
subprocess.run("dir", shell=True, capture_output=False)
```

Other notes: for some reason I get an error if I don't add shell=True, so maybe 
that contributes? I am on Windows 10 if that matters.

----------
components: Library (Lib)
messages: 400561
nosy: DragonEggBedrockBreaking
priority: normal
severity: normal
status: open
title: subprocess.run(capture_output=Bool) does the opposite of expected
versions: Python 3.9

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue45048>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to