Skip to content

Instantly share code, notes, and snippets.

@omgjlk
Created December 11, 2013 18:53
Show Gist options
  • Save omgjlk/7916239 to your computer and use it in GitHub Desktop.
Save omgjlk/7916239 to your computer and use it in GitHub Desktop.
diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/con
index 68c6f17..3007304 100644
--- a/lib/ansible/runner/connection_plugins/ssh.py
+++ b/lib/ansible/runner/connection_plugins/ssh.py
@@ -228,18 +228,20 @@ class Connection(object):
raise errors.AnsibleError('Incorrect sudo password')
if p.stdout in rfd:
- dat = os.read(p.stdout.fileno(), 9000)
+ dat = p.stdout.read(9000)
stdout += dat
if dat == '':
rpipes.remove(p.stdout)
if p.stderr in rfd:
- dat = os.read(p.stderr.fileno(), 9000)
+ dat = p.stderr.read(9000)
stderr += dat
if dat == '':
rpipes.remove(p.stderr)
- if not rpipes or p.poll() is not None:
- p.wait()
+ if not rpipes and p.poll() is not None:
break
+ elif p.poll() == None:
+ p.wait()
+
stdin.close() # close stdin after we read from stdout (see also issue #84
if C.HOST_KEY_CHECKING and not_in_host_file:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment