don't spin writer daemon when < /dev/null (#25170)

This commit is contained in:
Dylan Simon 2021-08-03 00:39:38 -04:00 committed by GitHub
parent 2dd2a5b167
commit 507d3c841c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -533,13 +533,15 @@ def __enter__(self):
# Sets a daemon that writes to file what it reads from a pipe
try:
# need to pass this b/c multiprocessing closes stdin in child.
input_multiprocess_fd = None
try:
input_multiprocess_fd = MultiProcessFd(
os.dup(sys.stdin.fileno())
)
if sys.stdin.isatty():
input_multiprocess_fd = MultiProcessFd(
os.dup(sys.stdin.fileno())
)
except BaseException:
# just don't forward input if this fails
input_multiprocess_fd = None
pass
with replace_environment(self.env):
self.process = multiprocessing.Process(