From c9e038b4d0dfed81d73c9c67040bbbc2c3ef138e Mon Sep 17 00:00:00 2001 From: leechenghsiu Date: Sun, 6 Sep 2026 23:07:35 +0800 Subject: [PATCH] fix: exit non-zero when a command fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cmd/main.go logged the error returned by rootCmd.Execute() and then fell off the end of main, so every failure — unknown command, bad flag, 401 from the API, missing workspace — exited 0. Shells (`set -e`, `&&`), CI and the agent sandbox's bash tool all read the exit status, so a failed `zeabur` call was indistinguishable from a successful one. Exit 1 after logging. Output is unchanged. Co-Authored-By: Claude Fable 5.1 --- cmd/main.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmd/main.go b/cmd/main.go index da5c524..b7129a1 100644 --- a/cmd/main.go +++ b/cmd/main.go @@ -33,13 +33,14 @@ func main() { os.Args = append([]string{os.Args[0], "deploy"}, os.Args[1:]...) } - // log errors + // log errors and exit non-zero so callers can tell a failure from success if err := rootCmd.Execute(); err != nil { // when some errors occur(such as args dis-match), the log may not be initialized if factory.Log == nil { factory.Log = log.NewInfoLevel() } factory.Log.Error(err) + os.Exit(1) } }