On Aug 26, 7:47 pm, Jeff <[EMAIL PROTECTED]> wrote:
> On Aug 26, 5:58 pm, Jamis Buck <[EMAIL PROTECTED]> wrote:
>
>
>
> > You can capture the exit code via the on_request callback:
>
> > ssh.open_channel do |channel|
> > channel.on_request("exit-status") do |ch, data|
> > code = data.read_long
> > puts "finished with exit code: #{code}"
> > end
> > end
>
> > The #on_request callback is whenever the server sends a channel-
> > request packet to the client, with a type equal to the argument. In
> > this case, you're trapping all "exit-status" channel requests. The
> > data parameter is a Net::SSH::Buffer object containing the request-
> > specific data for the request. For exit-status, this will be a single
> > long integer, representing the exit status.
>
> > Hope that helps!
>
> Immensely!
I'm reading more of the source to learn how it works (source is great,
easy to read).
I think this snippet, taken from Net::SSH#start:
if block_given?
yield connection
connection.close
else
return connection
end
Should perhaps ensure that the connection will close when a block is
passed:
if block_given?
begin
yield connection
ensure
connection.close
end
else
return connection
end
At least, I *think* that's the intent when a block is provided to
#start. If so, I could try to contribute a patch with tests if
desired.
Thanks,
Jeff
--~--~---------~--~----~------------~-------~--~----~
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/capistrano
-~----------~----~----~----~------~----~------~--~---