Skip to content

Commit

Permalink
Fix 756 SSH command line parsing error to write to user instead of st…
Browse files Browse the repository at this point in the history
…derr (slackhq#757)
  • Loading branch information
brad-defined authored Nov 23, 2022
1 parent 813b64f commit 9a8892c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions sshd/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,13 @@ func execCommand(c *Command, args []string, w StringWriter) error {
if c.Flags != nil {
fl, fs = c.Flags()
if fl != nil {
//TODO: handle the error
fl.Parse(args)
// SetOutput() here in case fl.Parse dumps usage.
fl.SetOutput(w.GetWriter())
err := fl.Parse(args)
if err != nil {
// fl.Parse has dumped error information to the user via the w writer.
return err
}
args = fl.Args()
}
}
Expand Down

0 comments on commit 9a8892c

Please sign in to comment.