Issue #848: Closing stdin after we read from stdout
This commit is contained in:
parent
05a128c2be
commit
6a18075640
1 changed files with 1 additions and 1 deletions
|
@ -98,12 +98,12 @@ class SSHConnection(object):
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
# 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
|
||||||
p.stdin.close()
|
|
||||||
stdout = ''
|
stdout = ''
|
||||||
while p.poll() is None:
|
while p.poll() is None:
|
||||||
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)
|
stdout += os.read(p.stdout.fileno(), 1024)
|
||||||
|
p.stdin.close() # close stdin after we read from stdout (see also issue #848)
|
||||||
# older versions of ssh generate this error which we ignore
|
# older versions of ssh generate this error which we ignore
|
||||||
stdout=stdout.replace("tcgetattr: Invalid argument\n", "")
|
stdout=stdout.replace("tcgetattr: Invalid argument\n", "")
|
||||||
# suppress Ubuntu 10.04/12.04 error on -tt option
|
# suppress Ubuntu 10.04/12.04 error on -tt option
|
||||||
|
|
Loading…
Reference in a new issue