From 5c589af19130179bc5cbb15aa9cc08147effe40a Mon Sep 17 00:00:00 2001 From: Aaron Bassett Date: Tue, 4 Mar 2014 15:58:12 -0500 Subject: [PATCH] fix missing stdin in _parallel_runner --- lib/ansible/runner/__init__.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index dfcd0487925..a69f0f24e5e 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -1075,9 +1075,17 @@ class Runner(object): job_queue.put(host) result_queue = manager.Queue() + try: + fileno = sys.stdin.fileno() + except ValueError: + fileno = None + workers = [] for i in range(self.forks): - new_stdin = os.fdopen(os.dup(sys.stdin.fileno())) + if fileno is not None: + new_stdin = os.fdopen(os.dup(fileno)) + else: + new_stdin = None prc = multiprocessing.Process(target=_executor_hook, args=(job_queue, result_queue, new_stdin)) prc.start()