Skip to content

Commit 4a2b0c7

Browse files
committed
flush stdout/stderr on exit
1 parent ee8bcab commit 4a2b0c7

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

graalpython/lib-graalpython/pyio_patches.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ def open(*args, **kwargs):
9595
sys.stderr.mode = "w"
9696
sys.__stderr__ = sys.stderr
9797

98+
import atexit
99+
atexit.register(sys.stdout.close)
100+
atexit.register(sys.stderr.close)
98101

99102
# See comment in _pyio.py. This method isn't strictly necessary and is provided
100103
# on CPython for performance. Because it goes through memoryview, it is slower

0 commit comments

Comments
 (0)