tolerate 'batch' systems that mess with stdin (#23596)

* tolerate 'batch' systems taht mess with stdin

fixes #23541

* have pause on windows tolerate devnull

* tuplie
pull/23713/head
Brian Coca 8 years ago committed by GitHub
parent 1ef2b6b302
commit 586fcae398

@ -68,6 +68,7 @@ class WorkerProcess(multiprocessing.Process):
self._variable_manager = variable_manager
self._shared_loader_obj = shared_loader_obj
if sys.stdin.isatty():
# dupe stdin, if we have one
self._new_stdin = sys.stdin
try:
@ -83,6 +84,9 @@ class WorkerProcess(multiprocessing.Process):
except (AttributeError, ValueError):
# couldn't get stdin's fileno, so we just carry on
pass
else:
# set to /dev/null
self._new_stdin = os.devnull
def run(self):
'''

@ -125,8 +125,9 @@ class ActionModule(ActionBase):
fd = None
try:
fd = self._connection._new_stdin.fileno()
except ValueError:
# someone is using a closed file descriptor as stdin
except (ValueError, AttributeError):
# ValueError: someone is using a closed file descriptor as stdin
# AttributeError: someone is using a null file descriptor as stdin on windoez
pass
if fd is not None:
if isatty(fd):

Loading…
Cancel
Save