diff options
author | wxiaoguang <wxiaoguang@gmail.com> | 2023-08-05 23:37:04 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-05 23:37:04 +0800 |
commit | fa431b377d7055c6c1362787eebda5b8b67e8d58 (patch) | |
tree | b03657e475d1527b30629dd9751bda5598403517 /main.go | |
parent | 8a97cdd91bff61129505d63311a0686c61abca71 (diff) | |
download | gitea-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.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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() } |