Skip to content

Commit

Permalink
scripts/
Browse files Browse the repository at this point in the history
  • Loading branch information
julian-smith-artifex-com committed Sep 25, 2024
1 parent ad612ec commit bcffacc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
14 changes: 11 additions & 3 deletions scripts/jlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -1598,10 +1598,18 @@ def fn(text, o=o):
' or support o() or o.write().'
)
o_decoder = decoders_ensure(o.encoding)
def fn(text):
o.write(text)
def o_fn(text, o=o):
if errors == 'strict':
o.write(text)
else:
# This is probably only necessary on Windows, where
# sys.stdout can be cp1252 and will sometimes raise
# UnicodeEncodeError. We hard-ignore these errors.
try:
o.write(text)
except Exception as e:
o.write(f'\n[Ignoring Exception: {e}]\n')
o.flush() # Seems to be necessary on Windows.
o_fn = fn
if o_prefix:
o_fn = StreamPrefix( o_fn, o_prefix).write
if not o_decoder:
Expand Down
3 changes: 3 additions & 0 deletions scripts/wrap/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2853,6 +2853,9 @@ def system(command):
)
if state.state_.windows:
out_rel = os.path.relpath( out, build_dirs.dir_so)
# Some Windows machines, e.g. on Github, seem to use a
# default encoding that cannot handle the output from
# test-csharp.exe.
sys.stdout.reconfigure(encoding='utf8')
jlib.system(f'cd {build_dirs.dir_so} && {mono} {out_rel}', verbose=1)
else:
Expand Down

0 comments on commit bcffacc

Please sign in to comment.