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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 def running_pids(self, process_name_filter): | 76 def running_pids(self, process_name_filter): |
77 running_pids = [] | 77 running_pids = [] |
78 for process_name, process_pid in self._running_pids.iteritems(): | 78 for process_name, process_pid in self._running_pids.iteritems(): |
79 if process_name_filter(process_name): | 79 if process_name_filter(process_name): |
80 running_pids.append(process_pid) | 80 running_pids.append(process_pid) |
81 | 81 |
82 _log.info("MOCK running_pids: %s" % running_pids) | 82 _log.info("MOCK running_pids: %s" % running_pids) |
83 return running_pids | 83 return running_pids |
84 | 84 |
85 def run_and_throw_if_fail(self, args, quiet=False, cwd=None, env=None): | 85 def run_and_throw_if_fail(self, args, quiet=False, cwd=None, env=None): |
| 86 self.calls.append(args) |
86 if self._should_log: | 87 if self._should_log: |
87 env_string = "" | 88 env_string = "" |
88 if env: | 89 if env: |
89 env_string = ", env=%s" % env | 90 env_string = ", env=%s" % env |
90 _log.info("MOCK run_and_throw_if_fail: %s, cwd=%s%s" % (args, cwd, e
nv_string)) | 91 _log.info("MOCK run_and_throw_if_fail: %s, cwd=%s%s" % (args, cwd, e
nv_string)) |
91 if self._should_throw_when_run.intersection(args): | 92 if self._should_throw_when_run.intersection(args): |
92 raise ScriptError("Exception for %s" % args, output="MOCK command ou
tput") | 93 raise ScriptError("Exception for %s" % args, output="MOCK command ou
tput") |
93 return "MOCK output of child process" | 94 return "MOCK output of child process" |
94 | 95 |
95 def command_for_printing(self, args): | 96 def command_for_printing(self, args): |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 if self._run_command_fn: | 197 if self._run_command_fn: |
197 return self._run_command_fn(args) | 198 return self._run_command_fn(args) |
198 if return_exit_code: | 199 if return_exit_code: |
199 return self._exit_code | 200 return self._exit_code |
200 if self._exit_code and error_handler: | 201 if self._exit_code and error_handler: |
201 script_error = ScriptError(script_args=args, exit_code=self._exit_co
de, output=self._output) | 202 script_error = ScriptError(script_args=args, exit_code=self._exit_co
de, output=self._output) |
202 error_handler(script_error) | 203 error_handler(script_error) |
203 if return_stderr: | 204 if return_stderr: |
204 return self._output + self._stderr | 205 return self._output + self._stderr |
205 return self._output | 206 return self._output |
OLD | NEW |