Commit e9a68681 authored by Leigh Stoller's avatar Leigh Stoller

Capture stderr in unix (used to be this way, but someone set it to

zero, probably for debugging) so that silly ssh warnings do not appear
on console.

Add -T option to ssh to avoid tty allocation on server side; no need
for that.

Add a couple of destructors to make sure that ssh is torn down when
destroying a proxy wrapper.
parent 7fc807d0
......@@ -142,7 +142,7 @@ class SSHConnection:
args = flags + " " + ssh_host + " " + handler
if use_ssh:
cmd = "ssh -x -C -o 'CompressionLevel 5' " + args
cmd = "ssh -T -x -C -o 'CompressionLevel 5' " + args
pass
else:
# Use the PyTTY plink, equivalent to the ssh command.
......@@ -151,9 +151,10 @@ class SSHConnection:
if not nt:
# Popen3 objects, and the wait method, are Unix-only.
self.myChild = popen2.Popen3(cmd, 0)
self.rfile = self.myChild.fromchild
self.wfile = self.myChild.tochild
self.myChild = popen2.Popen3(cmd, 1)
self.rfile = self.myChild.fromchild
self.wfile = self.myChild.tochild
self.errfile = self.myChild.childerr
pass
else:
# Open the pipe in Binary mode so it doesn't mess with CR-LFs.
......@@ -195,8 +196,9 @@ class SSHConnection:
# Close the connection.
#
def close(self):
self.rfile.close()
self.wfile.close()
self.errfile.close()
self.rfile.close()
if self.myChild:
self.myChild.wait()
self.myChild = None
......@@ -243,6 +245,12 @@ class SSHTransport:
self.ssh_config = ssh_config
self.user_agent = user_agent
return
def __del__(self):
for key, val in self.connections.items():
val.close()
pass
return;
##
# Send a request to the destination.
......@@ -510,6 +518,10 @@ class SSHServerProxy:
self.__path = path
return
def __del__(self):
del self.__transport
return
##
# Send a request to the server.
#
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment