Commit 4a982271 authored by maruel@chromium.org's avatar maruel@chromium.org

Defaults stdin to VOID for capture and check_output()

Since no output is user visible anyway, causing a hang with no clue about what
to type in.

R=dpranke@chromium.org
BUG=
TEST=

Review URL: http://codereview.chromium.org/6823091

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@81302 0039d316-1c4b-4281-b951-d872f2087c98
parent 6c7723e7
...@@ -259,7 +259,10 @@ def capture(args, **kwargs): ...@@ -259,7 +259,10 @@ def capture(args, **kwargs):
- Discards returncode. - Discards returncode.
- Discards stderr. By default sets stderr=STDOUT. - Discards stderr. By default sets stderr=STDOUT.
- Blocks stdin by default since no output will be visible.
""" """
if kwargs.get('stdin') is None:
kwargs['stdin'] = VOID
if kwargs.get('stdout') is None: if kwargs.get('stdout') is None:
kwargs['stdout'] = PIPE kwargs['stdout'] = PIPE
if kwargs.get('stderr') is None: if kwargs.get('stderr') is None:
...@@ -275,7 +278,10 @@ def check_output(args, **kwargs): ...@@ -275,7 +278,10 @@ def check_output(args, **kwargs):
- Discards stderr. By default sets stderr=STDOUT. - Discards stderr. By default sets stderr=STDOUT.
- Throws if return code is not 0. - Throws if return code is not 0.
- Works even prior to python 2.7. - Works even prior to python 2.7.
- Blocks stdin by default since no output will be visible.
""" """
if kwargs.get('stdin') is None:
kwargs['stdin'] = VOID
if kwargs.get('stdout') is None: if kwargs.get('stdout') is None:
kwargs['stdout'] = PIPE kwargs['stdout'] = PIPE
if kwargs.get('stderr') is None: if kwargs.get('stderr') is None:
......
...@@ -125,6 +125,7 @@ class Subprocess2Test(unittest.TestCase): ...@@ -125,6 +125,7 @@ class Subprocess2Test(unittest.TestCase):
expected = { expected = {
'args': ['foo'], 'args': ['foo'],
'a':True, 'a':True,
'stdin': subprocess2.VOID,
'stdout': subprocess2.PIPE, 'stdout': subprocess2.PIPE,
'stderr': subprocess2.STDOUT, 'stderr': subprocess2.STDOUT,
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment