equal
deleted
inserted
replaced
124 # Python 3 implements its own I/O streams. |
124 # Python 3 implements its own I/O streams. |
125 # TODO: .buffer might not exist if std streams were replaced; we'll need |
125 # TODO: .buffer might not exist if std streams were replaced; we'll need |
126 # a silly wrapper to make a bytes stream backed by a unicode one. |
126 # a silly wrapper to make a bytes stream backed by a unicode one. |
127 |
127 |
128 # sys.stdin can be None |
128 # sys.stdin can be None |
129 stdin = sys.stdin.buffer if sys.stdin else sys.stdin |
129 if sys.stdin: |
|
130 stdin = sys.stdin.buffer |
|
131 else: |
|
132 stdin = open(os.devnull, 'rb') |
|
133 os.close(stdin.fileno()) |
130 stdout = _make_write_all(sys.stdout.buffer) |
134 stdout = _make_write_all(sys.stdout.buffer) |
131 stderr = _make_write_all(sys.stderr.buffer) |
135 stderr = _make_write_all(sys.stderr.buffer) |
132 if pycompat.iswindows: |
136 if pycompat.iswindows: |
133 # Work around Windows bugs. |
137 # Work around Windows bugs. |
134 stdout = platform.winstdout(stdout) |
138 stdout = platform.winstdout(stdout) |