22import os
33import sys
44import tempfile
5+ import subprocess
56from contextlib import contextmanager
67from os .path import abspath
78from os .path import join as pjoin
8- from subprocess import STDOUT , check_call , check_output
99from typing import TYPE_CHECKING , Any , Iterator , Mapping , Optional , Sequence
1010import warnings
1111
@@ -82,13 +82,13 @@ def default_subprocess_runner(
8282) -> None :
8383 """The default method of calling the wrapper subprocess.
8484
85- This uses :func:`subprocess.check_call ` under the hood.
85+ This uses :func:`subprocess.run ` under the hood.
8686 """
8787 env = os .environ .copy ()
8888 if extra_environ :
8989 env .update (extra_environ )
9090
91- check_call (cmd , cwd = cwd , env = env )
91+ subprocess . run (cmd , cwd = cwd , env = env , check = True )
9292
9393
9494def quiet_subprocess_runner (
@@ -98,13 +98,21 @@ def quiet_subprocess_runner(
9898) -> None :
9999 """Call the subprocess while suppressing output.
100100
101- This uses :func:`subprocess.check_output ` under the hood.
101+ This uses :func:`subprocess.run` with `stdout=PIPE, stderr=STDOUT ` under the hood.
102102 """
103103 env = os .environ .copy ()
104104 if extra_environ :
105105 env .update (extra_environ )
106106
107- check_output (cmd , cwd = cwd , env = env , stderr = STDOUT )
107+ # Capturing output in case it fails (available on the exception object)
108+ subprocess .run (
109+ cmd ,
110+ cwd = cwd ,
111+ env = env ,
112+ stdout = subprocess .PIPE ,
113+ stderr = subprocess .STDOUT ,
114+ check = True ,
115+ )
108116
109117
110118def norm_and_check (source_tree : str , requested : str ) -> str :
0 commit comments