Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: subprocess2.py

Issue 14643009: Don't discard stderr. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Remove debugging print statements Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tests/subprocess2_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding=utf8 1 # coding=utf8
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 """Collection of subprocess wrapper functions. 5 """Collection of subprocess wrapper functions.
6 6
7 In theory you shouldn't need anything else in subprocess, or this module failed. 7 In theory you shouldn't need anything else in subprocess, or this module failed.
8 """ 8 """
9 9
10 import cStringIO 10 import cStringIO
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 # When the pipe fills up, it would deadlock this process. 348 # When the pipe fills up, it would deadlock this process.
349 if self.stdout and not self.stdout_cb and not self.stdout_is_void: 349 if self.stdout and not self.stdout_cb and not self.stdout_is_void:
350 stdout = [] 350 stdout = []
351 self.stdout_cb = stdout.append 351 self.stdout_cb = stdout.append
352 if self.stderr and not self.stderr_cb and not self.stderr_is_void: 352 if self.stderr and not self.stderr_cb and not self.stderr_is_void:
353 stderr = [] 353 stderr = []
354 self.stderr_cb = stderr.append 354 self.stderr_cb = stderr.append
355 self._tee_threads(input) 355 self._tee_threads(input)
356 if stdout is not None: 356 if stdout is not None:
357 stdout = ''.join(stdout) 357 stdout = ''.join(stdout)
358 stderr = None
359 if stderr is not None: 358 if stderr is not None:
360 stderr = ''.join(stderr) 359 stderr = ''.join(stderr)
361 return (stdout, stderr) 360 return (stdout, stderr)
362 361
363 362
364 def communicate(args, timeout=None, **kwargs): 363 def communicate(args, timeout=None, **kwargs):
365 """Wraps subprocess.Popen().communicate() and add timeout support. 364 """Wraps subprocess.Popen().communicate() and add timeout support.
366 365
367 Returns ((stdout, stderr), returncode). 366 Returns ((stdout, stderr), returncode).
368 367
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 439
441 - Throws if return code is not 0. 440 - Throws if return code is not 0.
442 - Works even prior to python 2.7. 441 - Works even prior to python 2.7.
443 - Blocks stdin by default if not specified since no output will be visible. 442 - Blocks stdin by default if not specified since no output will be visible.
444 - As per doc, "The stdout argument is not allowed as it is used internally." 443 - As per doc, "The stdout argument is not allowed as it is used internally."
445 """ 444 """
446 kwargs.setdefault('stdin', VOID) 445 kwargs.setdefault('stdin', VOID)
447 if 'stdout' in kwargs: 446 if 'stdout' in kwargs:
448 raise ValueError('stdout argument not allowed, it will be overridden.') 447 raise ValueError('stdout argument not allowed, it will be overridden.')
449 return check_call_out(args, stdout=PIPE, **kwargs)[0] 448 return check_call_out(args, stdout=PIPE, **kwargs)[0]
OLDNEW
« no previous file with comments | « no previous file | tests/subprocess2_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698