fix thread rssh param, indentation, rescue close errors

git-svn-id: file:///home/svn/framework3/trunk@10581 4d416f70-5f16-0410-b530-b9f4589650da
unstable
Joshua Drake 2010-10-07 00:12:12 +00:00
parent 352b4cf1c8
commit eb6da40f69
1 changed files with 41 additions and 39 deletions

View File

@ -25,11 +25,10 @@ class CommandStream
self.thread = Thread.new(ssh,cmd,cleanup) do |rssh,rcmd,rcleanup| self.thread = Thread.new(ssh,cmd,cleanup) do |rssh,rcmd,rcleanup|
begin begin
info = rssh.transport.socket.getpeername
info = ssh.transport.socket.getpeername
self.lsock.peerinfo = "#{info[1]}:#{info[2]}" self.lsock.peerinfo = "#{info[1]}:#{info[2]}"
info = ssh.transport.socket.getsockname info = rssh.transport.socket.getsockname
self.lsock.localinfo = "#{info[1]}:#{info[2]}" self.lsock.localinfo = "#{info[1]}:#{info[2]}"
rssh.open_channel do |rch| rssh.open_channel do |rch|
@ -39,12 +38,14 @@ class CommandStream
c[:data] = '' c[:data] = ''
c.on_eof do c.on_eof do
self.rsock.close self.rsock.close rescue nil
self.ssh.close rescue nil
self.thread.kill self.thread.kill
end end
c.on_close do c.on_close do
self.rsock.close self.rsock.close rescue nil
self.ssh.close rescue nil
self.thread.kill self.thread.kill
end end
@ -57,7 +58,6 @@ class CommandStream
end end
self.channel = c self.channel = c
end end
end end
@ -77,6 +77,8 @@ class CommandStream
rescue ::Exception => e rescue ::Exception => e
self.error = e self.error = e
#::Kernel.warn "BOO: #{e.inspect}"
#::Kernel.warn e.backtrace.join("\n")
ensure ensure
self.monitor.kill if self.monitor self.monitor.kill if self.monitor
end end