| OLD | NEW |
| 1 # Copyright (C) 2011 Google Inc. All rights reserved. | 1 # Copyright (C) 2011 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 return running_pids | 91 return running_pids |
| 92 | 92 |
| 93 def command_for_printing(self, args): | 93 def command_for_printing(self, args): |
| 94 string_args = map(unicode, args) | 94 string_args = map(unicode, args) |
| 95 return " ".join(string_args) | 95 return " ".join(string_args) |
| 96 | 96 |
| 97 def run_command(self, | 97 def run_command(self, |
| 98 args, | 98 args, |
| 99 cwd=None, | 99 cwd=None, |
| 100 input=None, | 100 input=None, |
| 101 # pylint: disable=W0613 | 101 # pylint: disable=unused-argument |
| 102 # unused argument | |
| 103 timeout_seconds=None, | 102 timeout_seconds=None, |
| 104 error_handler=None, | 103 error_handler=None, |
| 105 return_exit_code=False, | 104 return_exit_code=False, |
| 106 return_stderr=True, | 105 return_stderr=True, |
| 107 decode_output=False, | 106 decode_output=False, |
| 108 env=None, | 107 env=None, |
| 109 debug_logging=False): | 108 debug_logging=False): |
| 110 | 109 |
| 111 self.calls.append(args) | 110 self.calls.append(args) |
| 112 | 111 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 error_handler=None, | 198 error_handler=None, |
| 200 return_exit_code=False, | 199 return_exit_code=False, |
| 201 return_stderr=True, | 200 return_stderr=True, |
| 202 decode_output=False, | 201 decode_output=False, |
| 203 env=None, | 202 env=None, |
| 204 debug_logging=False): | 203 debug_logging=False): |
| 205 self.calls.append(args) | 204 self.calls.append(args) |
| 206 assert isinstance(args, list) or isinstance(args, tuple) | 205 assert isinstance(args, list) or isinstance(args, tuple) |
| 207 assert all(isinstance(arg, basestring) for arg in args) | 206 assert all(isinstance(arg, basestring) for arg in args) |
| 208 if self._exception: | 207 if self._exception: |
| 209 raise self._exception # pylint: disable=E0702 | 208 raise self._exception # pylint: disable=raising-bad-type |
| 210 if self._run_command_fn: | 209 if self._run_command_fn: |
| 211 return self._run_command_fn(args) | 210 return self._run_command_fn(args) |
| 212 if return_exit_code: | 211 if return_exit_code: |
| 213 return self._exit_code | 212 return self._exit_code |
| 214 if self._exit_code and error_handler: | 213 if self._exit_code and error_handler: |
| 215 script_error = ScriptError(script_args=args, exit_code=self._exit_co
de, output=self._output) | 214 script_error = ScriptError(script_args=args, exit_code=self._exit_co
de, output=self._output) |
| 216 error_handler(script_error) | 215 error_handler(script_error) |
| 217 if return_stderr: | 216 if return_stderr: |
| 218 return self._output + self._stderr | 217 return self._output + self._stderr |
| 219 return self._output | 218 return self._output |
| OLD | NEW |