diff options
author | Manoj Gupta <manojgupta@google.com> | 2019-08-02 16:06:24 -0700 |
---|---|---|
committer | Manoj Gupta <manojgupta@chromium.org> | 2019-08-02 23:34:56 +0000 |
commit | db3e218f34a7c5eb2808ce40bdc051e269873b6a (patch) | |
tree | 2d4641d05b1052d2066619eabfea95e8a35deb3f /cros_utils | |
parent | 2a1663f1dc3673f4a314bba6fd73b26bf563f3f2 (diff) | |
download | toolchain-utils-db3e218f34a7c5eb2808ce40bdc051e269873b6a.tar.gz |
command_executer: Pass custom env in ChrootRunCommand.
Previous CL:1733646 missed the case of ChrootRunCommand.
Add the custom env to it as well.
BUG=None
TEST=unit tests.
Change-Id: I3e09d89cb40550d52de3d880c6b6b4d6f0e71d64
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/1733649
Reviewed-by: Zhizhou Yang <zhizhouy@google.com>
Tested-by: Manoj Gupta <manojgupta@chromium.org>
Diffstat (limited to 'cros_utils')
-rw-r--r-- | cros_utils/command_executer.py | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/cros_utils/command_executer.py b/cros_utils/command_executer.py index 3e710afe..08e4e6ae 100644 --- a/cros_utils/command_executer.py +++ b/cros_utils/command_executer.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright 2011 The Chromium OS Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. @@ -348,7 +349,8 @@ class CommandExecuter(object): command_timeout=None, terminated_timeout=10, print_to_console=True, - cros_sdk_options=''): + cros_sdk_options='', + env=None): """Runs a command within the chroot. Returns triplet (returncode, stdout, stderr). @@ -376,7 +378,8 @@ class CommandExecuter(object): # the output from chroot creation steps. if return_output: ret = self.RunCommand( - 'cd %s; cros_sdk %s -- true' % (chromeos_root, cros_sdk_options)) + 'cd %s; cros_sdk %s -- true' % (chromeos_root, cros_sdk_options), + env=env) if ret: return (ret, '', '') @@ -391,7 +394,8 @@ class CommandExecuter(object): command_terminator=command_terminator, command_timeout=command_timeout, terminated_timeout=terminated_timeout, - print_to_console=print_to_console) + print_to_console=print_to_console, + env=env) os.remove(command_file) return ret |