summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjctanner <tanner.jc@gmail.com>2013-12-12 07:01:35 -0800
committerJames Tanner <tanner.jc@gmail.com>2013-12-18 20:25:16 -0500
commite357ecbd1ee1cdb4bac12137dcce16cbe62b8b5a (patch)
tree36b127a1dc5f04a77c470c973b8506ca32c0e690
parent06e52f34a77485e7426997db081300e28d96d039 (diff)
downloadansible-e357ecbd1ee1cdb4bac12137dcce16cbe62b8b5a.tar.gz
Merge pull request #5254 from j2sol/fix-ssh-missing-quotes
Make sure ssh pipes are empty before moving on
-rw-r--r--lib/ansible/runner/connection_plugins/ssh.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py
index 68c6f17d4a..9a32c920d0 100644
--- a/lib/ansible/runner/connection_plugins/ssh.py
+++ b/lib/ansible/runner/connection_plugins/ssh.py
@@ -237,9 +237,13 @@ class Connection(object):
stderr += dat
if dat == '':
rpipes.remove(p.stderr)
- if not rpipes or p.poll() is not None:
- p.wait()
+ # only break out if we've emptied the pipes, or there is nothing to
+ # read from and the process has finished.
+ if (not rpipes or not rfd) and p.poll() is not None:
break
+ # Calling wait while there are still pipes to read can cause a lock
+ elif not rpipes and p.poll() == None:
+ p.wait()
stdin.close() # close stdin after we read from stdout (see also issue #848)
if C.HOST_KEY_CHECKING and not_in_host_file: