diff options
author | Zhizhou Yang <zhizhouy@google.com> | 2020-02-04 16:45:13 -0800 |
---|---|---|
committer | Zhizhou Yang <zhizhouy@google.com> | 2020-02-05 02:21:40 +0000 |
commit | e013418dade906a2828b33fcb6432010953de847 (patch) | |
tree | 54766a41f89ec953534eeae68e6e3b502756521e /cros_utils/command_executer.py | |
parent | 360774425d0160d12cbf49f9f68d021c3967641b (diff) | |
download | toolchain-utils-e013418dade906a2828b33fcb6432010953de847.tar.gz |
cros_utils: Do not use encoding in NamedTemporaryFile
This parameter is introduced in python 3 and there are many scripts
calling cros_utils with python 2.
TEST=passed all unittests.
BUG=chromium:1048938, chromium:1048884
Change-Id: If4a8b9f9e9ef5a1720647c7187d7d08e1d6655b0
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/toolchain-utils/+/2037144
Reviewed-by: George Burgess <gbiv@chromium.org>
Commit-Queue: Zhizhou Yang <zhizhouy@google.com>
Tested-by: Zhizhou Yang <zhizhouy@google.com>
Diffstat (limited to 'cros_utils/command_executer.py')
-rwxr-xr-x | cros_utils/command_executer.py | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/cros_utils/command_executer.py b/cros_utils/command_executer.py index 002aa754..39bff5ed 100755 --- a/cros_utils/command_executer.py +++ b/cros_utils/command_executer.py @@ -240,9 +240,10 @@ class CommandExecuter(object): return command def WriteToTempShFile(self, contents): + # TODO(crbug.com/1048938): use encoding='utf-8' when all dependencies have + # migrated to python 3. with tempfile.NamedTemporaryFile( - 'w', encoding='utf-8', delete=False, prefix=os.uname()[1], - suffix='.sh') as f: + 'w', delete=False, prefix=os.uname()[1], suffix='.sh') as f: f.write('#!/bin/bash\n') f.write(contents) f.flush() @@ -366,9 +367,10 @@ class CommandExecuter(object): if self.logger: self.logger.LogCmd(command, print_to_console=print_to_console) + # TODO(crbug.com/1048938): use encoding='utf-8' when all dependencies have + # migrated to python 3. with tempfile.NamedTemporaryFile( 'w', - encoding='utf-8', delete=False, dir=os.path.join(chromeos_root, 'src/scripts'), suffix='.sh', |