New submission from Pekka Klärck <pekka.kla...@gmail.com>:

I'm porting old scripts from Python 2.7 to 3.6 and plan to change 
`subprocess.call()` to `subprocess.run()` at the same time. When using `call()` 
I've used `tempfile.TemporaryFile` as stdout because it's documentation has 
this warning:

    Note: Do not use stdout=PIPE or stderr=PIPE with this function. The child 
process will block if it generates enough output to a pipe to fill up the OS 
pipe buffer as the pipes are not being read from.

Interestingly there is no such note in the docs of `run()`, and based on my 
(possibly inadequate) testing I couldn't get it to hang either. I'm still 
somewhat worried about using `stdout=PIPE` with it because the docs don't 
explicitly say it would be safe. I'm especially worried because the docs of 
`call()` nowadays say that it's equivalent to `run(...).returncode`. If that's 
the case, then I would expect the warning in `call()` to apply also to `run()`. 
Or is the warning nowadays outdated altogether?

----------
messages: 315510
nosy: pekka.klarck
priority: normal
severity: normal
status: open
title: `subprocess.run` documentation doesn't tell is using `stdout=PIPE` safe

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

Reply via email to