capistrano / capistrano/sshkit

On exit<>0 netssh backend deletes all command output

Aperta
#59 4 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Ruby
Stelle
1.2k
Fork
257
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

_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]

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Start in lib/sshkit/backends/netssh.rb at _execute(), then compare capture() with test() and its raise_on_non_zero_exit handling. Trace how stdout, stderr, logging, and non-zero exits interact; done means the intended failure behavior and output preservation are defined and covered by the relevant tests.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
ruby
Ambito
devops
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.