Skip to content

Commit

Permalink
Log command *after* setting its exit_status.
Browse files Browse the repository at this point in the history
This restores SSHKit 1.6 behavior and ensures that command completion status
messages appear in the log output.
  • Loading branch information
mattbrictson committed Mar 2, 2015
1 parent 63a73b2 commit 96685da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -5,6 +5,7 @@ appear at the top.

## `master` (Unreleased)

* Fix a regression in 1.7.0 that caused command completion messages to be removed from log output. @mattbrictson
* Add your entries here, remember to credit yourself however you want to be
credited!

Expand Down
7 changes: 5 additions & 2 deletions lib/sshkit/backends/netssh.rb
Expand Up @@ -150,7 +150,6 @@ def _execute(*args)
end
chan.on_request("exit-status") do |ch, data|
exit_status = data.read_long
output << cmd
end
#chan.on_request("exit-signal") do |ch, data|
# # TODO: This gets called if the program is killed by a signal
Expand All @@ -175,7 +174,11 @@ def _execute(*args)
end
ssh.loop
end
cmd.exit_status = exit_status if exit_status
# Set exit_status and log the result upon completion
if exit_status
cmd.exit_status = exit_status
output << cmd
end
end
end

Expand Down

0 comments on commit 96685da

Please sign in to comment.