[issue16624] subprocess.check_output should allow specifying stdin as a string
Serhiy Storchaka
report at bugs.python.org
Thu Apr 18 20:19:57 CEST 2013
Serhiy Storchaka added the comment:
I think that it will be better not introduce a new argument, but reuse stdin. Just allow io.BytesIO (or perhaps even any file object) be specified as stdin.
The change will be straightforward:
if isinstance(stdin, io.BytesIO):
inputdata = stdin.read()
stdin = PIPE
Or more general:
if not(stdin is None or stdin in (PIPE, DEVNULL) or isinstance(stdin, int)):
try:
stdin.fileno()
except (AttributeError, UnsupportedOperation, OSError):
inputdata = stdin.read()
stdin = PIPE
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16624>
_______________________________________
More information about the Python-bugs-list
mailing list