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

Side by Side Diff: scripts/run_cmd.py

Issue 199353003: Bigger hammer: Run each command and block, without piping stdout/stderr (Closed) Base URL: https://skia.googlesource.com/buildbot.git@master
Patch Set: Created 6 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2014 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2014 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 5
6 6
7 """Run a command and report its results in machine-readable format.""" 7 """Run a command and report its results in machine-readable format."""
8 8
9 9
10 import collections 10 import collections
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 166
167 def _launch_cmd(cmd): 167 def _launch_cmd(cmd):
168 """Launch the given command. Non-blocking. 168 """Launch the given command. Non-blocking.
169 169
170 Args: 170 Args:
171 cmd: list of strings; command to run. 171 cmd: list of strings; command to run.
172 Returns: 172 Returns:
173 subprocess.Popen instance. 173 subprocess.Popen instance.
174 """ 174 """
175 print ' '.join(cmd) 175 print ' '.join(cmd)
176 subprocess.call(cmd)
176 return subprocess.Popen(cmd, shell=False, stderr=subprocess.PIPE, 177 return subprocess.Popen(cmd, shell=False, stderr=subprocess.PIPE,
177 stdout=subprocess.PIPE) 178 stdout=subprocess.PIPE)
178 179
179 180
180 def _get_result(popen): 181 def _get_result(popen):
181 """Get the results from a running process. Blocks until the process completes. 182 """Get the results from a running process. Blocks until the process completes.
182 183
183 Args: 184 Args:
184 popen: subprocess.Popen instance. 185 popen: subprocess.Popen instance.
185 Returns: 186 Returns:
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 setattr(options, cmd, args) 354 setattr(options, cmd, args)
354 except IndexError: 355 except IndexError:
355 parser.print_usage() 356 parser.print_usage()
356 sys.exit(1) 357 sys.exit(1)
357 return options 358 return options
358 359
359 360
360 if '__main__' == __name__: 361 if '__main__' == __name__:
361 parsed_args = parse_args() 362 parsed_args = parse_args()
362 run(parsed_args.cmd).print_results(pretty=parsed_args.pretty) 363 run(parsed_args.cmd).print_results(pretty=parsed_args.pretty)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698