Skip to content

Commit 084cd0a

Browse files
committed
sys.std{in,out,err} implemented in the most simple way
- It respects what already exists if any - Otherwise it opens de UNIX standard files Caveats: - May be not on the proper place - Is open to discussion on what codec, or if should be opened as bytes - Can be also done in Rust side
1 parent 336364c commit 084cd0a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/_sitebuiltins.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@
1010

1111
import sys
1212

13+
sys.stdin = getattr(sys, 'stdin', False) or open('/dev/stdin')
14+
sys.stdout = getattr(sys, 'stdout', False) or open('/dev/stdout', 'w')
15+
sys.stderr = getattr(sys, 'stderr', False) or open('/dev/stderr', 'w')
16+
17+
1318
class Quitter(object):
1419
def __init__(self, name, eof):
1520
self.name = name

0 commit comments

Comments
 (0)