fix(Get): Errors should be reported by their executing shell; all errors were bubbling up to PDA where they should not be
This commit is contained in:
parent
2d756a5642
commit
a5e2e39784
1 changed files with 8 additions and 5 deletions
13
cmd/get.go
13
cmd/get.go
|
|
@ -100,12 +100,15 @@ func runCmd(command string) error {
|
|||
cmd.Stdin = os.Stdin
|
||||
|
||||
if err := cmd.Run(); err != nil {
|
||||
// Manually relay the error returned from the sub-command.
|
||||
fmt.Fprintf(os.Stderr, "%v\n", err)
|
||||
// ExitError indicates running the command was successful, but the command itself failed.
|
||||
// We only ever want to report on errors caused by the CLI tool itself.
|
||||
// An ExitError means this tool was successful in running the command, so return nil.
|
||||
// A non-ExitError means this tool failed, so return err.
|
||||
if _, ok := err.(*exec.ExitError); !ok {
|
||||
return err
|
||||
}
|
||||
// Never bubble this error up to PDA itself,
|
||||
// because if it ran at all then PDA did not error.
|
||||
// Arbitrary user commands should handle their own errors.
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue