Merge pull request #110691 from Ruw-Van/fix-windows-logfile-encoding

Fix windows logfile encoding
This commit is contained in:
Thaddeus Crews 2025-09-30 18:35:19 -05:00
commit c6189a83b9
No known key found for this signature in database
GPG key ID: 8C6E5FEB5FC03CCC

View file

@ -316,7 +316,7 @@ def configure_msvc(env: "SConsEnvironment"):
if not caught and (is_cl and re_cl_capture.match(line)) or (not is_cl and re_link_capture.match(line)):
caught = True
try:
with open(capture_path, "a", encoding=sys.stdout.encoding) as log:
with open(capture_path, "a", encoding=sys.stdout.encoding, errors="replace") as log:
log.write(line + "\n")
except OSError:
print_warning(f'Failed to log captured line: "{line}".')