Skip to content

Commit e785c1e

Browse files
committed
Ignore stderr when retrieving SwifitPM’s bin path
1 parent ee8c9db commit e785c1e

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
@@ -47,10 +47,14 @@ def check_call(cmd: List[str], additional_env: Dict[str, str] = {}, verbose: boo
4747
subprocess.check_call(cmd, env=env_with_additional_env(additional_env), stderr=subprocess.STDOUT)
4848

4949

50-
def check_output(cmd: List[str], additional_env: Dict[str, str] = {}, verbose: bool = False) -> str:
50+
def check_output(cmd: List[str], additional_env: Dict[str, str] = {}, capture_stderr: bool = True, verbose: bool = False) -> str:
5151
if verbose:
5252
print_cmd(cmd=cmd, additional_env=additional_env)
53-
return subprocess.check_output(cmd, env=env_with_additional_env(additional_env), stderr=subprocess.STDOUT, encoding='utf-8')
53+
if capture_stderr:
54+
stderr = subprocess.STDOUT
55+
else:
56+
stderr = subprocess.DEVNULL
57+
return subprocess.check_output(cmd, env=env_with_additional_env(additional_env), stderr=stderr, encoding='utf-8')
5458

5559
# -----------------------------------------------------------------------------
5660
# SwiftPM wrappers
@@ -61,7 +65,7 @@ def swiftpm_bin_path(swift_exec: str, swiftpm_args: List[str], additional_env: D
6165
Return the path of the directory that contains the binaries produced by this package.
6266
"""
6367
cmd = [swift_exec, 'build', '--show-bin-path'] + swiftpm_args
64-
return check_output(cmd, additional_env=additional_env, verbose=verbose).strip()
68+
return check_output(cmd, additional_env=additional_env, capture_stderr=False, verbose=verbose).strip()
6569

6670

6771
def get_build_target(swift_exec: str, args: argparse.Namespace) -> str:

0 commit comments

Comments
 (0)