Skip to content

Commit

Permalink
always display error before exit
Browse files Browse the repository at this point in the history
  • Loading branch information
olegbespalov committed Feb 11, 2025
1 parent 5c6a2fe commit 25f26bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cmd/k6exec/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ func newCmd(args []string, levelVar *slog.LevelVar) *cobra.Command {
//nolint:forbidigo
func runCmd(cmd *cobra.Command) {
if err := cmd.Execute(); err != nil {
var eerr *exec.ExitError
slog.Error(formatError(err))

var eerr *exec.ExitError
if errors.As(err, &eerr) {
os.Exit(eerr.ExitCode())
}

slog.Error(formatError(err))
os.Exit(1)
}
}

0 comments on commit 25f26bf

Please sign in to comment.