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
This commit is contained in:
Alan Justino committed 2019-10-12 16:29:53 +02:00
1 parent 336364c80d
commit 084cd0ae3d
1 file changed
+5
+5
View File
@@ -10,6 +10,11 @@ The objects used by the site module to add custom builtins.
import sys
sys.stdin = getattr(sys, 'stdin', False) or open('/dev/stdin')
sys.stdout = getattr(sys, 'stdout', False) or open('/dev/stdout', 'w')
sys.stderr = getattr(sys, 'stderr', False) or open('/dev/stderr', 'w')
class Quitter(object):
def __init__(self, name, eof):
self.name = name