Chromium Code Reviews| OLD | NEW | 
|---|---|
| 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 241 raise CygwinRebaseError( | 241 raise CygwinRebaseError( | 
| 242 e.errno, | 242 e.errno, | 
| 243 args, | 243 args, | 
| 244 kwargs.get('cwd'), | 244 kwargs.get('cwd'), | 
| 245 None, | 245 None, | 
| 246 'Visit ' | 246 'Visit ' | 
| 247 'http://code.google.com/p/chromium/wiki/CygwinDllRemappingFailure ' | 247 'http://code.google.com/p/chromium/wiki/CygwinDllRemappingFailure ' | 
| 248 'to learn how to fix this error; you need to rebase your cygwin ' | 248 'to learn how to fix this error; you need to rebase your cygwin ' | 
| 249 'dlls') | 249 'dlls') | 
| 250 # Popen() can throw OSError when cwd or args[0] doesn't exist. | 250 # Popen() can throw OSError when cwd or args[0] doesn't exist. | 
| 251 raise OSError('%s or %s probably doesn\'t exist' % | 251 raise OSError('Execution failed with error: %s.\n' | 
| 252 (kwargs.get('cwd'), args[0])) | 252 'Check that %s or %s exist and have execution permission.' | 
| 
 
M-A Ruel
2014/04/29 17:19:23
optional: if you want to be more helpful, you coul
 
pgervais
2014/04/29 17:26:58
That would indeed be cleaner, but str(e) gives tha
 
 | |
| 253 % (str(e), kwargs.get('cwd'), args[0])) | |
| 253 | 254 | 
| 254 def _tee_threads(self, input): # pylint: disable=W0622 | 255 def _tee_threads(self, input): # pylint: disable=W0622 | 
| 255 """Does I/O for a process's pipes using threads. | 256 """Does I/O for a process's pipes using threads. | 
| 256 | 257 | 
| 257 It's the simplest and slowest implementation. Expect very slow behavior. | 258 It's the simplest and slowest implementation. Expect very slow behavior. | 
| 258 | 259 | 
| 259 If there is a callback and it doesn't keep up with the calls, the timeout | 260 If there is a callback and it doesn't keep up with the calls, the timeout | 
| 260 effectiveness will be delayed accordingly. | 261 effectiveness will be delayed accordingly. | 
| 261 """ | 262 """ | 
| 262 # Queue of either of <threadname> when done or (<threadname>, data). In | 263 # Queue of either of <threadname> when done or (<threadname>, data). In | 
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 505 | 506 | 
| 506 - Throws if return code is not 0. | 507 - Throws if return code is not 0. | 
| 507 - Works even prior to python 2.7. | 508 - Works even prior to python 2.7. | 
| 508 - Blocks stdin by default if not specified since no output will be visible. | 509 - Blocks stdin by default if not specified since no output will be visible. | 
| 509 - As per doc, "The stdout argument is not allowed as it is used internally." | 510 - As per doc, "The stdout argument is not allowed as it is used internally." | 
| 510 """ | 511 """ | 
| 511 kwargs.setdefault('stdin', VOID) | 512 kwargs.setdefault('stdin', VOID) | 
| 512 if 'stdout' in kwargs: | 513 if 'stdout' in kwargs: | 
| 513 raise ValueError('stdout argument not allowed, it will be overridden.') | 514 raise ValueError('stdout argument not allowed, it will be overridden.') | 
| 514 return check_call_out(args, stdout=PIPE, **kwargs)[0] | 515 return check_call_out(args, stdout=PIPE, **kwargs)[0] | 
| OLD | NEW |