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

Side by Side Diff: build/android/pylib/cmd_helper.py

Issue 11312239: Modify the Android test running scripts so they can be used from WebKit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 1 month 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 | « build/android/pylib/android_commands.py ('k') | build/android/pylib/forwarder.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 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 """A wrapper for subprocess to make calling shell commands easier.""" 5 """A wrapper for subprocess to make calling shell commands easier."""
6 6
7 7 import os
8 import logging 8 import logging
9 import subprocess 9 import subprocess
10 10
11 import constants
11 12
12 def RunCmd(args, cwd=None): 13 def RunCmd(args, cwd=None):
13 """Opens a subprocess to execute a program and returns its return value. 14 """Opens a subprocess to execute a program and returns its return value.
14 15
15 Args: 16 Args:
16 args: A string or a sequence of program arguments. The program to execute is 17 args: A string or a sequence of program arguments. The program to execute is
17 the string or the first item in the args sequence. 18 the string or the first item in the args sequence.
18 cwd: If not None, the subprocess's current directory will be changed to 19 cwd: If not None, the subprocess's current directory will be changed to
19 |cwd| before it's executed. 20 |cwd| before it's executed.
20 21
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 """ 59 """
59 logging.info(str(args) + ' ' + (cwd or '')) 60 logging.info(str(args) + ' ' + (cwd or ''))
60 p = subprocess.Popen(args=args, cwd=cwd, stdout=subprocess.PIPE, 61 p = subprocess.Popen(args=args, cwd=cwd, stdout=subprocess.PIPE,
61 stderr=subprocess.PIPE, shell=shell) 62 stderr=subprocess.PIPE, shell=shell)
62 stdout, stderr = p.communicate() 63 stdout, stderr = p.communicate()
63 exit_code = p.returncode 64 exit_code = p.returncode
64 if stderr: 65 if stderr:
65 logging.critical(stderr) 66 logging.critical(stderr)
66 logging.info(stdout[:4096]) # Truncate output longer than 4k. 67 logging.info(stdout[:4096]) # Truncate output longer than 4k.
67 return (exit_code, stdout) 68 return (exit_code, stdout)
69
70 class OutDirectory(object):
71 _out_directory = constants.CHROME_DIR
72 @staticmethod
73 def set(out_directory):
74 OutDirectory._out_directory = out_directory
75 @staticmethod
76 def get():
77 return OutDirectory._out_directory
OLDNEW
« no previous file with comments | « build/android/pylib/android_commands.py ('k') | build/android/pylib/forwarder.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698