|
|
@ -223,6 +223,7 @@ class Connection(object):
|
|
|
|
rpipes = [p.stdout, p.stderr]
|
|
|
|
rpipes = [p.stdout, p.stderr]
|
|
|
|
while True:
|
|
|
|
while True:
|
|
|
|
rfd, wfd, efd = select.select(rpipes, [], rpipes, 1)
|
|
|
|
rfd, wfd, efd = select.select(rpipes, [], rpipes, 1)
|
|
|
|
|
|
|
|
process_over = p.poll() is not None
|
|
|
|
|
|
|
|
|
|
|
|
# fail early if the sudo password is wrong
|
|
|
|
# fail early if the sudo password is wrong
|
|
|
|
if self.runner.sudo and sudoable and self.runner.sudo_pass:
|
|
|
|
if self.runner.sudo and sudoable and self.runner.sudo_pass:
|
|
|
@ -232,22 +233,11 @@ class Connection(object):
|
|
|
|
raise errors.AnsibleError('Incorrect sudo password')
|
|
|
|
raise errors.AnsibleError('Incorrect sudo password')
|
|
|
|
|
|
|
|
|
|
|
|
if p.stdout in rfd:
|
|
|
|
if p.stdout in rfd:
|
|
|
|
dat = os.read(p.stdout.fileno(), 9000)
|
|
|
|
stdout += os.read(p.stdout.fileno(), 9000)
|
|
|
|
stdout += dat
|
|
|
|
|
|
|
|
if dat == '':
|
|
|
|
|
|
|
|
rpipes.remove(p.stdout)
|
|
|
|
|
|
|
|
if p.stderr in rfd:
|
|
|
|
if p.stderr in rfd:
|
|
|
|
dat = os.read(p.stderr.fileno(), 9000)
|
|
|
|
stderr += os.read(p.stderr.fileno(), 9000)
|
|
|
|
stderr += dat
|
|
|
|
if process_over:
|
|
|
|
if dat == '':
|
|
|
|
|
|
|
|
rpipes.remove(p.stderr)
|
|
|
|
|
|
|
|
# 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
|
|
|
|
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)
|
|
|
|
stdin.close() # close stdin after we read from stdout (see also issue #848)
|
|
|
|
|
|
|
|
|
|
|
|
if C.HOST_KEY_CHECKING and not_in_host_file:
|
|
|
|
if C.HOST_KEY_CHECKING and not_in_host_file:
|
|
|
|