diff options
author | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-13 16:39:29 +0200 |
---|---|---|
committer | Rémi Verschelde <rverschelde@gmail.com> | 2024-04-13 16:39:29 +0200 |
commit | 43b32f9d0baa13ef8e7079521fbef7c4f090aa88 (patch) | |
tree | 4e81930e970750f4f126641cf1f6dc6b59b553e4 | |
parent | b2b51e10f88513d99ad61cdd8748fa17e21ea93e (diff) | |
parent | 6df57d2d7d411f45d398c0a8a85e578f4d800828 (diff) | |
download | redot-engine-43b32f9d0baa13ef8e7079521fbef7c4f090aa88.tar.gz |
Merge pull request #90626 from Repiteo/scons/msvc-sucks-eggs
SCons: Fix `silence_msvc` regression
-rw-r--r-- | platform/windows/detect.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/platform/windows/detect.py b/platform/windows/detect.py index 9aa32a7b2d..f34d479345 100644 --- a/platform/windows/detect.py +++ b/platform/windows/detect.py @@ -411,10 +411,13 @@ def configure_msvc(env: "SConsEnvironment", vcvars_msvc_config): 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 |