| 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:
|
|
|