Merge stdout and stderr as that is what is expected
Should also fix problems where something might output an error before the sudo prompt.
This commit is contained in:
parent
c8f416a2c2
commit
14c61c6f8f
1 changed files with 4 additions and 4 deletions
|
@ -72,13 +72,13 @@ class SSHConnection(object):
|
||||||
sudo_output = ''
|
sudo_output = ''
|
||||||
ssh_cmd.append(sudocmd)
|
ssh_cmd.append(sudocmd)
|
||||||
p = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE,
|
p = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
if self.runner.sudo_pass:
|
if self.runner.sudo_pass:
|
||||||
fcntl.fcntl(p.stdout, fcntl.F_SETFL,
|
fcntl.fcntl(p.stdout, fcntl.F_SETFL,
|
||||||
fcntl.fcntl(p.stdout, fcntl.F_GETFL) | os.O_NONBLOCK)
|
fcntl.fcntl(p.stdout, fcntl.F_GETFL) | os.O_NONBLOCK)
|
||||||
while not sudo_output.endswith(prompt):
|
while not sudo_output.endswith(prompt):
|
||||||
rfd, wfd, efd = select.select([p.stdout, p.stderr], [],
|
rfd, wfd, efd = select.select([p.stdout], [],
|
||||||
[p.stdout, p.stderr], self.runner.timeout)
|
[p.stdout], self.runner.timeout)
|
||||||
if p.stdout in rfd:
|
if p.stdout in rfd:
|
||||||
chunk = p.stdout.read()
|
chunk = p.stdout.read()
|
||||||
if not chunk:
|
if not chunk:
|
||||||
|
@ -93,7 +93,7 @@ class SSHConnection(object):
|
||||||
ssh_cmd.append(cmd)
|
ssh_cmd.append(cmd)
|
||||||
p = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE,
|
p = subprocess.Popen(ssh_cmd, stdin=subprocess.PIPE,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||||
return (p.stdin, p.stdout, p.stderr)
|
return (p.stdin, p.stdout, '')
|
||||||
|
|
||||||
def put_file(self, in_path, out_path):
|
def put_file(self, in_path, out_path):
|
||||||
''' transfer a file from local to remote '''
|
''' transfer a file from local to remote '''
|
||||||
|
|
Loading…
Reference in a new issue