Skip to content

Commit

Permalink
If stdout/stderr are null streams, don't forward data to them.
Browse files Browse the repository at this point in the history
  • Loading branch information
tbttfox committed Mar 6, 2024
1 parent 908e3ff commit 28b6a76
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions preditor/stream/director.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,11 @@ def __init__(self, manager, state, old_stream=None, *args, **kwargs):
old_stream = None
elif old_stream is None:
if state == STDOUT:
old_stream = sys.stdout
if getattr(sys.stdout, 'name', '') != 'nul':
old_stream = sys.stdout
elif state == STDERR:
old_stream = sys.stderr
if getattr(sys.stderr, 'name', '') != 'nul':
old_stream = sys.stderr
self.old_stream = old_stream

def close(self):
Expand Down

0 comments on commit 28b6a76

Please sign in to comment.