Skip to content

Commit

Permalink
Merge pull request #328 from dsx1986/main
Browse files Browse the repository at this point in the history
fix CONOUT not found on windows, fallback to sys.stdout
  • Loading branch information
zhiyuan8 authored Dec 27, 2024
2 parents 06e69c5 + 3616259 commit e72d30c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nexa/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,11 @@ def _spin(self):
def __enter__(self):
if self._use_alternate_stream:
if sys.platform == "win32": # Windows
self.stream = open('CONOUT$', "w")
try:
self.stream = open('CONOUT$', "w")
except OSError:
# Fall back to stdout if CONOUT$ is not available
self.stream = sys.stdout
else:
try:
self.stream = open('/dev/tty', "w")
Expand Down

0 comments on commit e72d30c

Please sign in to comment.