We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6991239 commit 8fd57f6Copy full SHA for 8fd57f6
graalpython/lib-graalpython/pyio_patches.py
@@ -95,9 +95,22 @@ def open(*args, **kwargs):
95
sys.stderr.mode = "w"
96
sys.__stderr__ = sys.stderr
97
98
+
99
+# Try to close the std streams when we exit
100
import atexit
-atexit.register(sys.stdout.close)
-atexit.register(sys.stderr.close)
101
+def close_stdouts(so=sys.stdout, se=sys.stderr):
102
+ try:
103
+ so.close()
104
+ except:
105
+ pass
106
107
+ se.close()
108
109
110
111
112
+atexit.register(close_stdouts)
113
114
115
# See comment in _pyio.py. This method isn't strictly necessary and is provided
116
# on CPython for performance. Because it goes through memoryview, it is slower
0 commit comments