Skip to content

Commit

Permalink
[easy][errors] Fix double error (#699)
Browse files Browse the repository at this point in the history
## Summary

Fixes minor double error issue. (This was pulled out of
#695)

## How was it tested?

```bash
devbox global add hello
hello is now installed
Warning: the devbox global profile is not in your $PATH.

Add the following line to your shell's rcfile (e.g., ~/.bashrc or ~/.zshrc)
and restart your shell to fix this:

	eval "$(devbox global shellenv)"
```
  • Loading branch information
mikeland73 committed Feb 28, 2023
1 parent e5aaf97 commit f2ad449
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/boxcli/midcobra/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,15 @@ func (d *DebugMiddleware) postRun(cmd *cobra.Command, args []string, runErr erro
if usererr.HasUserMessage(runErr) {
if usererr.IsWarning(runErr) {
ux.Fwarning(cmd.ErrOrStderr(), runErr.Error())
return
} else {
color.New(color.FgRed).Fprintf(cmd.ErrOrStderr(), "\nError: %s\n\n", runErr.Error())
}
} else {
color.New(color.FgRed).Fprintf(cmd.ErrOrStderr(), "Error: %v\n\n", runErr)
}

st := debug.EarliestStackTrace(runErr)
color.New(color.FgRed).Fprintf(cmd.ErrOrStderr(), "Error: %v\n\n", runErr)
var exitErr *exec.ExitError
if errors.As(runErr, &exitErr) {
debug.Log("Command stderr: %s\n", exitErr.Stderr)
Expand Down

0 comments on commit f2ad449

Please sign in to comment.