From 05d7c142e9b808abdf1704efbeaa516500085262 Mon Sep 17 00:00:00 2001 From: Joe Rickerby Date: Sun, 22 Nov 2020 10:35:40 +0000 Subject: [PATCH] Subprocess stderr goes to stdout on Mac and Windows too --- cibuildwheel/macos.py | 3 ++- cibuildwheel/windows.py | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cibuildwheel/macos.py b/cibuildwheel/macos.py index eb5ce5aa..e2cddb6e 100644 --- a/cibuildwheel/macos.py +++ b/cibuildwheel/macos.py @@ -22,7 +22,8 @@ def call(args: Union[str, Sequence[Union[str, PathLike]]], env: Optional[Dict[st else: print('+ ' + ' '.join(shlex.quote(str(a)) for a in args)) - return subprocess.check_call(args, env=env, cwd=cwd, shell=shell) + # run the process. Subprocess stderr is routed to stdout to keep output interleaved + return subprocess.check_call(args, env=env, cwd=cwd, shell=shell, stderr=subprocess.STDOUT) class PythonConfiguration(NamedTuple): diff --git a/cibuildwheel/windows.py b/cibuildwheel/windows.py index f9997927..4532e1bb 100644 --- a/cibuildwheel/windows.py +++ b/cibuildwheel/windows.py @@ -25,12 +25,13 @@ def call(args: Sequence[Union[str, PathLike]], env: Optional[Dict[str, str]] = N print('+ ' + ' '.join(str(a) for a in args)) # we use shell=True here, even though we don't need a shell due to a bug # https://bugs.python.org/issue8557 - subprocess.check_call([str(a) for a in args], env=env, cwd=cwd, shell=True) + subprocess.check_call([str(a) for a in args], env=env, cwd=cwd, shell=True, stderr=subprocess.STDOUT) def shell(command: str, env: Optional[Dict[str, str]] = None, cwd: Optional[str] = None) -> None: print(f'+ {command}') - subprocess.check_call(command, env=env, cwd=cwd, shell=True) + # route stderr to stdout so output remains interleaved + subprocess.check_call(command, env=env, cwd=cwd, shell=True, stderr=subprocess.STDOUT) def get_nuget_args(version: str, arch: str) -> List[str]: