Fix 756 SSH command line parsing error to write to user instead of stderr (#757)

This commit is contained in:
brad-defined 2022-11-22 21:55:27 -05:00 committed by GitHub
parent 813b64ffb1
commit 9a8892c526
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 2 deletions

View File

@ -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()
}
}