From af4f0bd0087d5d4067ad11f45dc646230c3ced7f Mon Sep 17 00:00:00 2001 From: James Cammarata Date: Wed, 21 Aug 2013 22:37:09 -0500 Subject: [PATCH] Fix for "argument must be an int, or have a fileno() method" error The issue was that, when forks == 1, the _executor() function was being called with None for the value of new_stdin. Fixes #3841, #3902 --- lib/ansible/runner/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/ansible/runner/__init__.py b/lib/ansible/runner/__init__.py index 8f8c3276d1a..f0a8012f471 100644 --- a/lib/ansible/runner/__init__.py +++ b/lib/ansible/runner/__init__.py @@ -363,7 +363,10 @@ class Runner(object): return flags try: - self._new_stdin = new_stdin + if not new_stdin: + self._new_stdin = os.fdopen(os.dup(sys.stdin.fileno())) + else: + self._new_stdin = new_stdin exec_rc = self._executor_internal(host, new_stdin) if type(exec_rc) != ReturnData: