Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 7 additions & 14 deletions gyp/pylib/gyp/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -961,33 +961,26 @@ def ExpandVariables(input, phase, variables, build_file):
# Fix up command with platform specific workarounds.
contents = FixupPlatformCommand(contents)
try:
p = subprocess.Popen(
# stderr will be printed no matter what
result = subprocess.run(
contents,
shell=use_shell,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
stdin=subprocess.PIPE,
shell=use_shell,
cwd=build_file_dir,
check=False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
check=False
check=False,
text=True

)
except Exception as e:
raise GypError(
"%s while executing command '%s' in %s"
% (e, contents, build_file)
)

p_stdout, p_stderr = p.communicate("")
p_stdout = p_stdout.decode("utf-8")
p_stderr = p_stderr.decode("utf-8")

if p.wait() != 0 or p_stderr:
sys.stderr.write(p_stderr)
# Simulate check_call behavior, since check_call only exists
# in python 2.5 and later.
if result.returncode > 0:
raise GypError(
"Call to '%s' returned exit status %d while in %s."
% (contents, p.returncode, build_file)
% (contents, result.returncode, build_file)
)
replacement = p_stdout.rstrip()
replacement = result.stdout.decode("utf-8").rstrip()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add text = True to the run() call and then...

Suggested change
replacement = result.stdout.decode("utf-8").rstrip()
replacement = result.stdout.rstrip()


cached_command_results[cache_key] = replacement
else:
Expand Down