Update Net::SSH::CommandStream exception handling
parent
390e0e86f7
commit
cf00f20e11
|
@ -16,7 +16,10 @@ class CommandStream
|
|||
end
|
||||
|
||||
def shell_requested(channel, success)
|
||||
raise "could not request ssh shell" unless success
|
||||
unless success
|
||||
raise Net::SSH::ChannelRequestFailed, 'shell/exec channel request failed'
|
||||
end
|
||||
|
||||
channel[:data] = ''
|
||||
|
||||
channel.on_eof do
|
||||
|
@ -57,7 +60,7 @@ class CommandStream
|
|||
# A PTY will write us to {u,w}tmp and lastlog
|
||||
rch.request_pty if rpty
|
||||
if rcmd.nil?
|
||||
rch.send_channel_request("shell", &method(:shell_requested))
|
||||
rch.send_channel_request('shell', &method(:shell_requested))
|
||||
else
|
||||
rch.exec(rcmd, &method(:shell_requested))
|
||||
end
|
||||
|
@ -78,6 +81,7 @@ class CommandStream
|
|||
end
|
||||
|
||||
rescue ::Exception => e
|
||||
# XXX: This won't be set UNTIL there's a failure from a thread
|
||||
self.error = e
|
||||
#::Kernel.warn "BOO: #{e.inspect}"
|
||||
#::Kernel.warn e.backtrace.join("\n")
|
||||
|
|
Loading…
Reference in New Issue