From e97a22603fd9d6fd30417690c26677f74e65a962 Mon Sep 17 00:00:00 2001 From: Daniel Hokka Zakrisson Date: Thu, 27 Sep 2012 21:44:34 +0200 Subject: [PATCH] Make sure we get all data --- lib/ansible/runner/connection_plugins/ssh.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/lib/ansible/runner/connection_plugins/ssh.py b/lib/ansible/runner/connection_plugins/ssh.py index 97b8e26d2d..20c98bf803 100644 --- a/lib/ansible/runner/connection_plugins/ssh.py +++ b/lib/ansible/runner/connection_plugins/ssh.py @@ -102,10 +102,16 @@ class Connection(object): # We can't use p.communicate here because the ControlMaster may have stdout open as well stdout = '' - while p.poll() is None: + while True: rfd, wfd, efd = select.select([p.stdout], [], [p.stdout], 1) if p.stdout in rfd: - stdout += os.read(p.stdout.fileno(), 1024) + dat = os.read(p.stdout.fileno(), 9000) + stdout += dat + if dat == '': + p.wait() + break + elif p.poll() is not None: + break p.stdin.close() # close stdin after we read from stdout (see also issue #848) if p.returncode != 0 and stdout.find('Bad configuration option: ControlPersist') != -1: