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

Unified Diff: lib/cros_build_lib.py

Issue 6005004: WIP Chromite supporting "LEGACY" mode, as requested by Anush. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/crosutils.git@master
Patch Set: Created 10 years 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 side-by-side diff with in-line comments
Download patch
« chromite/chromite.sh ('K') | « chromite/specs/x86-generic.spec ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/cros_build_lib.py
diff --git a/lib/cros_build_lib.py b/lib/cros_build_lib.py
index 2e6876060c1dce08b93bfa630402f598e7ba548d..5cfa622e40782500763ad502257e695984a18edc 100644
--- a/lib/cros_build_lib.py
+++ b/lib/cros_build_lib.py
@@ -26,7 +26,8 @@ def GetCallerName():
def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
exit_code=False, redirect_stdout=False, redirect_stderr=False,
- cwd=None, input=None, enter_chroot=False, num_retries=0):
+ cwd=None, input=None, enter_chroot=False, num_retries=0,
+ env=None):
"""Runs a shell command.
Arguments:
@@ -43,6 +44,8 @@ def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
enter_chroot: this command should be run from within the chroot. If set,
cwd must point to the scripts directory.
num_retries: the number of retries to perform before dying
+ env: If non-None, should be a mapping for the environment variables of the
+ command. Useful syntax: env=dict(os.environ.items() + [('VAR', 'val')])
Returns:
If exit_code is True, returns the return code of the shell command.
@@ -70,7 +73,7 @@ def RunCommand(cmd, print_cmd=True, error_ok=False, error_message=None,
for retry_count in range(num_retries + 1):
try:
- proc = subprocess.Popen(cmd, cwd=cwd, stdin=stdin,
+ proc = subprocess.Popen(cmd, cwd=cwd, env=env, stdin=stdin,
stdout=stdout, stderr=stderr)
(output, error) = proc.communicate(input)
if exit_code and retry_count == num_retries:
« chromite/chromite.sh ('K') | « chromite/specs/x86-generic.spec ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698