Show More
@@ -50,6 +50,16 b' def isatty(fp):' | |||
|
50 | 50 | return False |
|
51 | 51 | |
|
52 | 52 | |
|
53 | class BadFile(io.RawIOBase): | |
|
54 | """Dummy file object to simulate closed stdio behavior""" | |
|
55 | ||
|
56 | def readinto(self, b): | |
|
57 | raise IOError(errno.EBADF, 'Bad file descriptor') | |
|
58 | ||
|
59 | def write(self, b): | |
|
60 | raise IOError(errno.EBADF, 'Bad file descriptor') | |
|
61 | ||
|
62 | ||
|
53 | 63 | class LineBufferedWrapper(object): |
|
54 | 64 | def __init__(self, orig): |
|
55 | 65 | self.orig = orig |
@@ -129,8 +139,7 b' if pycompat.ispy3:' | |||
|
129 | 139 | if sys.stdin: |
|
130 | 140 | stdin = sys.stdin.buffer |
|
131 | 141 | else: |
|
132 |
stdin = |
|
|
133 | os.close(stdin.fileno()) | |
|
142 | stdin = BadFile() | |
|
134 | 143 | stdout = _make_write_all(sys.stdout.buffer) |
|
135 | 144 | stderr = _make_write_all(sys.stderr.buffer) |
|
136 | 145 | if pycompat.iswindows: |
General Comments 0
You need to be logged in to leave comments.
Login now