aboutsummaryrefslogtreecommitdiffstats
path: root/main.go
diff options
context:
space:
mode:
authorwxiaoguang <wxiaoguang@gmail.com>2023-08-05 23:37:04 +0800
committerGitHub <noreply@github.com>2023-08-05 23:37:04 +0800
commitfa431b377d7055c6c1362787eebda5b8b67e8d58 (patch)
treeb03657e475d1527b30629dd9751bda5598403517 /main.go
parent8a97cdd91bff61129505d63311a0686c61abca71 (diff)
downloadgitea-fa431b377d7055c6c1362787eebda5b8b67e8d58.tar.gz
gitea-fa431b377d7055c6c1362787eebda5b8b67e8d58.zip
Fix incorrect CLI exit code and duplicate error message (#26346) (#26347)
Backport #26346 Follow the CLI refactoring, and add tests.
Diffstat (limited to 'main.go')
-rw-r--r--main.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/main.go b/main.go
index 9b561376c3..8b48e8142e 100644
--- a/main.go
+++ b/main.go
@@ -146,11 +146,11 @@ func main() {
app.Commands = append(app.Commands, subCmdWithIni...)
app.Commands = append(app.Commands, subCmdStandalone...)
- err := app.Run(os.Args)
- if err != nil {
- _, _ = fmt.Fprintf(app.Writer, "\nFailed to run with %s: %v\n", os.Args, err)
+ cli.OsExiter = func(code int) {
+ log.GetManager().Close()
+ os.Exit(code)
}
-
+ _ = cmd.RunMainApp(app, os.Args...) // all errors should have been handled by the RunMainApp
log.GetManager().Close()
}