capistrano / capistrano/sshkit
On exit<>0 netssh backend deletes all command output
- Dominant language
- Ruby
- Stars
- 1.2k
- Forks
- 257
- PR merge metrics
- No merged PRs in 30d
Description
_execute() in the netssh backend [assigns '' to stdout and stderr](https://github.com/capistrano/sshkit/blob/master/lib/sshkit/backends/netssh.rb#L135) when a non zero exit code which automatically produces the "command stderr: Nothing written" & "command stdout: Nothing written" logs. Is there a reason stdout/stderr are nixed?
This is confusing especially if the command has been dutifully printing things on stdout.
Also throwing an exception on exit<>0 by default totally destroys the usefulness of capture(). capture() should probably add raise_on_non_zero_exit: false in the arguments like test() does.
The point is that in most cases capturing the output is significant when there is an error - the successful case is the boring one. The way SSHKit's API is at the moment it seems it does not provide an easy way to grab the log and determine that a command failed.
The naive approach would be to let capture() return a tuple: [bool,output]
Contributor guide
Assessment
This issue has not been assessed yet.