1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Make sure we get all data

This commit is contained in:
Daniel Hokka Zakrisson 2012-09-27 21:44:34 +02:00
parent 36c1b4be0e
commit e97a22603f

View file

@ -102,10 +102,16 @@ class Connection(object):
# We can't use p.communicate here because the ControlMaster may have stdout open as well # We can't use p.communicate here because the ControlMaster may have stdout open as well
stdout = '' stdout = ''
while p.poll() is None: while True:
rfd, wfd, efd = select.select([p.stdout], [], [p.stdout], 1) rfd, wfd, efd = select.select([p.stdout], [], [p.stdout], 1)
if p.stdout in rfd: 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) 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: if p.returncode != 0 and stdout.find('Bad configuration option: ControlPersist') != -1: