Skip to content

Commit e40ee14

Browse files
authored
Merge pull request #42 from progrium/quiet-exit-status-logs
Do not log exit status messages
2 parents 098e2f8 + 1dd3e92 commit e40ee14

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

basher.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,14 @@ func ApplicationWithPath(
9494
}
9595
status, err := bash.Run("main", os.Args[1:])
9696
if err != nil {
97-
log.Fatal(err)
97+
// the string message for ExitError shouldn't be logged
98+
// as it is just `exit status $CODE`, which is redundant
99+
// when that code can just be used to exit the program
100+
if _, ok := err.(*exec.ExitError); ok && strings.HasPrefix(err.Error(), "exit status ") {
101+
os.Exit(status)
102+
} else {
103+
log.Fatal(err)
104+
}
98105
}
99106
os.Exit(status)
100107
}

0 commit comments

Comments
 (0)