Skip to content

Commit b048385

Browse files
committed
Ignore stderr when retrieving SwifitPM’s bin path
1 parent 5a55deb commit b048385

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

Utilities/build-script-helper.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,14 @@ def check_call(cmd: List[str], additional_env: Dict[str, str] = {}, verbose: boo
4444
subprocess.check_call(cmd, env=env_with_additional_env(additional_env), stderr=subprocess.STDOUT)
4545

4646

47-
def check_output(cmd: List[str], additional_env: Dict[str, str] = {}, verbose: bool = False) -> str:
47+
def check_output(cmd: List[str], additional_env: Dict[str, str] = {}, capture_stderr: bool = True, verbose: bool = False) -> str:
4848
if verbose:
4949
print_cmd(cmd=cmd, additional_env=additional_env)
50-
return subprocess.check_output(cmd, env=env_with_additional_env(additional_env), stderr=subprocess.STDOUT, encoding='utf-8')
50+
if capture_stderr:
51+
stderr = subprocess.STDOUT
52+
else:
53+
stderr = subprocess.DEVNULL
54+
return subprocess.check_output(cmd, env=env_with_additional_env(additional_env), stderr=stderr, encoding='utf-8')
5155

5256
# -----------------------------------------------------------------------------
5357
# SwiftPM wrappers
@@ -58,7 +62,7 @@ def swiftpm_bin_path(swift_exec: str, swiftpm_args: List[str], additional_env: D
5862
Return the path of the directory that contains the binaries produced by this package.
5963
"""
6064
cmd = [swift_exec, 'build', '--show-bin-path'] + swiftpm_args
61-
return check_output(cmd, additional_env=additional_env, verbose=verbose).strip()
65+
return check_output(cmd, additional_env=additional_env, capture_stderr=False, verbose=verbose).strip()
6266

6367
# -----------------------------------------------------------------------------
6468
# Build indexstore-db

0 commit comments

Comments
 (0)