Skip to content

Commit 96685da

Browse files
committed
Log command *after* setting its exit_status.
This restores SSHKit 1.6 behavior and ensures that command completion status messages appear in the log output.
1 parent 63a73b2 commit 96685da

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ appear at the top.
55

66
## `master` (Unreleased)
77

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

lib/sshkit/backends/netssh.rb

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,6 @@ def _execute(*args)
150150
end
151151
chan.on_request("exit-status") do |ch, data|
152152
exit_status = data.read_long
153-
output << cmd
154153
end
155154
#chan.on_request("exit-signal") do |ch, data|
156155
# # TODO: This gets called if the program is killed by a signal
@@ -175,7 +174,11 @@ def _execute(*args)
175174
end
176175
ssh.loop
177176
end
178-
cmd.exit_status = exit_status if exit_status
177+
# Set exit_status and log the result upon completion
178+
if exit_status
179+
cmd.exit_status = exit_status
180+
output << cmd
181+
end
179182
end
180183
end
181184

0 commit comments

Comments
 (0)