Skip to content

Commit

Permalink
Add a comment explaining what's going on
Browse files Browse the repository at this point in the history
  • Loading branch information
tbttfox committed Nov 2, 2023
1 parent f98987b commit 71081c8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions preditor/stream/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def __init__(self, manager, state, old_stream=None, *args, **kwargs):
old_stream = None
elif old_stream is None:
if state == STDOUT:
# On Windows if we're in pythonw.exe, then sys.stdout is named "nul"
# And it uses cp1252 encoding (which breaks with unicode)
# So if we find this nul TextIOWrapper, it's safe to just skip it
if getattr(sys.stdout, 'name', '') != 'nul':
old_stream = sys.stdout
elif state == STDERR:
Expand Down

0 comments on commit 71081c8

Please sign in to comment.