Skip to content

Commit 69b43d5

Browse files
committed
use the correct exit code on failure
1 parent ff2c0a8 commit 69b43d5

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

main.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ package main
22

33
import (
44
_ "embed"
5+
"errors"
56
"os"
7+
"os/exec"
68

79
"github.com/carapace-sh/carapace"
810
"github.com/pomdtr/smallweb/cmd"
@@ -15,6 +17,11 @@ func main() {
1517
root := cmd.NewCmdRoot(changelog)
1618
carapace.Gen(root)
1719
if err := root.Execute(); err != nil {
20+
var exitError *exec.ExitError
21+
if errors.As(err, &exitError) {
22+
os.Exit(exitError.ExitCode())
23+
}
24+
1825
os.Exit(1)
1926
}
2027
}

0 commit comments

Comments
 (0)