Commit b3bfb1cd authored by Pulkit Goyal's avatar Pulkit Goyal
Browse files

procutil: use os.devnull if sys.stdout/err is None

According to Yuya, it's better to make `procutil.stdin/err/out` always

This is a bandaid until someone suggests something better.
parent e40f52691dac
Pipeline #14888 passed with stage
in 34 minutes and 19 seconds
...@@ -131,8 +131,16 @@ if pycompat.ispy3: ...@@ -131,8 +131,16 @@ if pycompat.ispy3:
else: else:
stdin = open(os.devnull, 'rb') stdin = open(os.devnull, 'rb')
os.close(stdin.fileno()) os.close(stdin.fileno())
if sys.stdout:
stdout = _make_write_all(sys.stdout.buffer) stdout = _make_write_all(sys.stdout.buffer)
stdout = open(os.devnull, 'rb')
if sys.stderr:
stderr = _make_write_all(sys.stderr.buffer) stderr = _make_write_all(sys.stderr.buffer)
stderr = open(os.devnull, 'rb')
if pycompat.iswindows: if pycompat.iswindows:
# Work around Windows bugs. # Work around Windows bugs.
stdout = platform.winstdout(stdout) stdout = platform.winstdout(stdout)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment