Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SCons: Fix silence_msvc regression #90626

Merged
merged 1 commit into from
Apr 13, 2024
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
11 changes: 7 additions & 4 deletions platform/windows/detect.py
Original file line number Diff line number Diff line change
Expand Up @@ -411,10 +411,13 @@ def spawn_capture(sh, escape, cmd, args, env):
ret = old_spawn(sh, escape, cmd, args, env)

try:
with open(tmp_stdout_name, "rt", encoding=sys.stdout.encoding) as tmp_stdout:
# First line is always bloat, subsequent lines are always errors. This filter sends
# either just the errors to stderr, or an empty string to effectively do nothing.
sys.stderr.write("".join(tmp_stdout.readlines()[1:]))
with open(tmp_stdout_name, "rb") as tmp_stdout:
# First line is always bloat, subsequent lines are always errors. If content
# exists after discarding the first line, safely decode & send to stderr.
tmp_stdout.readline()
content = tmp_stdout.read()
if content:
sys.stderr.write(content.decode(sys.stdout.encoding, "replace"))
os.remove(tmp_stdout_name)
except OSError:
pass
Expand Down
Loading