exit 1 when a command does not exist (#4564)

This commit is contained in:
frek818
2025-06-11 02:29:41 -07:00
committed by GitHub
parent 0ea774e13d
commit d1136c3c5d
2 changed files with 11 additions and 1 deletions

View File

@@ -103,7 +103,10 @@ func Execute() int {
ctx := createRootContext()
rootCmd.ExecuteContext(ctx)
err := rootCmd.ExecuteContext(ctx)
if err != nil {
exitCode = 1
}
return exitCode
}

View File

@@ -15,6 +15,13 @@ load "$LIB_BATS_SUPPORT/load.bash"
[ $status -eq 0 ]
}
@test "steampipe nonexistant pass with 1 exit code" {
# this command should exit one since nonexistent does not exist
run steampipe nonexistant
echo $status
[ $status -eq 1 ]
}
function teardown_file() {
# list running processes
ps -ef | grep steampipe