From dca1add7b8279ff92e85dd91995eacfb82abb9b5 Mon Sep 17 00:00:00 2001 From: YR Chen Date: Mon, 28 Feb 2022 16:59:48 +0800 Subject: [PATCH] [utils] Enable text mode for `shell.run` --- utils/swift_build_support/swift_build_support/shell.py | 2 +- utils/update_checkout/update_checkout/update_checkout.py | 9 +++++---- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/utils/swift_build_support/swift_build_support/shell.py b/utils/swift_build_support/swift_build_support/shell.py index 32c39811aa06f..17f5c256742ba 100644 --- a/utils/swift_build_support/swift_build_support/shell.py +++ b/utils/swift_build_support/swift_build_support/shell.py @@ -218,7 +218,7 @@ def run(*args, **kwargs): return(None, 0, args) my_pipe = subprocess.Popen( - *args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs) + *args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf-8', **kwargs) (stdout, stderr) = my_pipe.communicate() ret = my_pipe.wait() diff --git a/utils/update_checkout/update_checkout/update_checkout.py b/utils/update_checkout/update_checkout/update_checkout.py index 2b9e859999f85..a2c907c06aab6 100755 --- a/utils/update_checkout/update_checkout/update_checkout.py +++ b/utils/update_checkout/update_checkout/update_checkout.py @@ -70,7 +70,7 @@ def check_parallel_results(results, op): print("%s failed (ret=%d): %s" % (r.repo_path, r.ret, r)) fail_count += 1 if r.stderr: - print(r.stderr.decode('utf-8')) + print(r.stderr) return fail_count @@ -280,13 +280,14 @@ def obtain_additional_swift_sources(pool_args): print("Cloning '" + repo_name + "'") if skip_history: - shell.run(['git', 'clone', '--recursive', '--depth', '1', - '--branch', repo_branch, remote, repo_name] + + shell.run(['git', 'clone', '-c', 'core.symlinks=true', '-c', 'core.autocrlf=input', + '--recursive', '--depth', '1', '--branch', repo_branch, remote, repo_name] + (['--no-tags'] if skip_tags else []), env=env, echo=True) else: - shell.run(['git', 'clone', '--recursive', remote, repo_name] + + shell.run(['git', 'clone', '-c', 'core.symlinks=true', '-c', 'core.autocrlf=input', + '--recursive', remote, repo_name] + (['--no-tags'] if skip_tags else []), env=env, echo=True)