Skip to content

Instantly share code, notes, and snippets.

@omgjlk
Created December 10, 2013 19:11
Show Gist options
  • Save omgjlk/7896349 to your computer and use it in GitHub Desktop.
Save omgjlk/7896349 to your computer and use it in GitHub Desktop.
diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py
index 68c6f17..74f5eef 100644
--- a/lib/ansible/runner/connection_plugins/ssh.py
+++ b/lib/ansible/runner/connection_plugins/ssh.py
@@ -228,15 +228,19 @@ class Connection(object):
raise errors.AnsibleError('Incorrect sudo password')
if p.stdout in rfd:
- dat = os.read(p.stdout.fileno(), 9000)
- stdout += dat
- if dat == '':
- rpipes.remove(p.stdout)
+ while True:
+ dat = os.read(p.stdout.fileno(), 9000)
+ stdout += dat
+ if dat == '' or len(dat) < 9000:
+ rpipes.remove(p.stdout)
+ break
if p.stderr in rfd:
- dat = os.read(p.stderr.fileno(), 9000)
- stderr += dat
- if dat == '':
- rpipes.remove(p.stderr)
+ while True:
+ dat = os.read(p.stderr.fileno(), 9000)
+ stderr += dat
+ if dat == '' or len(dat) < 9000:
+ rpipes.remove(p.stderr)
+ break
if not rpipes or p.poll() is not None:
p.wait()
break
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment