@@ -961,33 +961,26 @@ def ExpandVariables(input, phase, variables, build_file):
961
961
# Fix up command with platform specific workarounds.
962
962
contents = FixupPlatformCommand (contents )
963
963
try :
964
- p = subprocess .Popen (
964
+ # stderr will be printed no matter what
965
+ result = subprocess .run (
965
966
contents ,
966
- shell = use_shell ,
967
967
stdout = subprocess .PIPE ,
968
- stderr = subprocess .PIPE ,
969
- stdin = subprocess .PIPE ,
968
+ shell = use_shell ,
970
969
cwd = build_file_dir ,
970
+ check = False
971
971
)
972
972
except Exception as e :
973
973
raise GypError (
974
974
"%s while executing command '%s' in %s"
975
975
% (e , contents , build_file )
976
976
)
977
977
978
- p_stdout , p_stderr = p .communicate ("" )
979
- p_stdout = p_stdout .decode ("utf-8" )
980
- p_stderr = p_stderr .decode ("utf-8" )
981
-
982
- if p .wait () != 0 or p_stderr :
983
- sys .stderr .write (p_stderr )
984
- # Simulate check_call behavior, since check_call only exists
985
- # in python 2.5 and later.
978
+ if result .returncode > 0 :
986
979
raise GypError (
987
980
"Call to '%s' returned exit status %d while in %s."
988
- % (contents , p .returncode , build_file )
981
+ % (contents , result .returncode , build_file )
989
982
)
990
- replacement = p_stdout .rstrip ()
983
+ replacement = result . stdout . decode ( "utf-8" ) .rstrip ()
991
984
992
985
cached_command_results [cache_key ] = replacement
993
986
else :
0 commit comments