Skip to content

Commit

Permalink
Merge pull request #42 from progrium/quiet-exit-status-logs
Browse files Browse the repository at this point in the history
Do not log exit status messages
  • Loading branch information
josegonzalez authored May 16, 2022
2 parents 098e2f8 + 1dd3e92 commit e40ee14
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion basher.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,14 @@ func ApplicationWithPath(
}
status, err := bash.Run("main", os.Args[1:])
if err != nil {
log.Fatal(err)
// the string message for ExitError shouldn't be logged
// as it is just `exit status $CODE`, which is redundant
// when that code can just be used to exit the program
if _, ok := err.(*exec.ExitError); ok && strings.HasPrefix(err.Error(), "exit status ") {
os.Exit(status)
} else {
log.Fatal(err)
}
}
os.Exit(status)
}
Expand Down

0 comments on commit e40ee14

Please sign in to comment.