Skip to content

Commit 851bf3b

Browse files
committed
If execution errors, and --error-exit-code is set, return exit code 1, even without error log lines
1 parent 2bef1e8 commit 851bf3b

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

cmd/cmd.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ func Execute() {
5151
handleError(k, err)
5252
}
5353

54-
if logHadErrors {
55-
os.Exit(1)
56-
}
57-
5854
if !commands.SuppressVersionCheck {
5955
select {
6056
case version := <-versionChan:
@@ -63,6 +59,9 @@ func Execute() {
6359
}
6460
}
6561

62+
if logHadErrors || (commands.ErrorExitCode && err != nil) {
63+
os.Exit(1)
64+
}
6665
}
6766

6867
var logHadErrors bool

0 commit comments

Comments
 (0)