[docs] [issue33319] `subprocess.run` documentation doesn't tell is using `stdout=PIPE` safe

Pekka Klärck report at bugs.python.org
Mon Apr 23 04:23:44 EDT 2018


Pekka Klärck <pekka.klarck at gmail.com> added the comment:

My goal is to read stdout. It's good to hear `subprocess.run()` is deadlock-safe and I can use it safely. Making the docs explicit about it so that others know it's safe would in my opinion be a good idea as well.

Casual users don't know `run()` it uses `communicate()`, not `wait()`, internally, or even that this would mean it cannot deadlock. The current situation when the docs say that `call()` shouldn't be used with `stdout=PIPE` and that `call(...)` is equivalent to `run(...).returncode` indicates `stdout=PIPE` is unsafe with `run()` as well.

A separate questions is that if `call(...)` is equivalent to `run(...).returncode`, should it also be implemented that way. Based on this discussion it would avoid the problem with `stdout=PIPE` also in that case.

----------

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


More information about the docs mailing list