diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2021-11-07 11:11:27 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-07 11:11:27 +0800 |
commit | 69b61d437357235700306f28d22d21acc39bb2b5 (patch) | |
tree | 33af1d4d797b428556a323837fcc3eda38a54479 /cmd/doctor.go | |
parent | c9110eb5e4657e018695f084f37e1b423939e9e0 (diff) | |
download | gitea-69b61d437357235700306f28d22d21acc39bb2b5.tar.gz gitea-69b61d437357235700306f28d22d21acc39bb2b5.zip |
Fix bug on admin subcommand (#17533)
* Fix bug on admin subcommand
* Add signals for all initDB
Co-authored-by: Lauris BH <lauris@nix.lv>
Diffstat (limited to 'cmd/doctor.go')
-rw-r--r-- | cmd/doctor.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/cmd/doctor.go b/cmd/doctor.go index 19b26f09c6..498b859e41 100644 --- a/cmd/doctor.go +++ b/cmd/doctor.go @@ -96,7 +96,10 @@ func runRecreateTable(ctx *cli.Context) error { setting.Cfg.Section("log").Key("XORM").SetValue(",") setting.NewXORMLogService(!ctx.Bool("debug")) - if err := db.InitEngine(); err != nil { + stdCtx, cancel := installSignals() + defer cancel() + + if err := db.InitEngine(stdCtx); err != nil { fmt.Println(err) fmt.Println("Check if you are using the right config file. You can use a --config directive to specify one.") return nil @@ -128,6 +131,9 @@ func runDoctor(ctx *cli.Context) error { log.DelNamedLogger("console") log.DelNamedLogger(log.DEFAULT) + stdCtx, cancel := installSignals() + defer cancel() + // Now setup our own logFile := ctx.String("log-file") if !ctx.IsSet("log-file") { @@ -210,5 +216,5 @@ func runDoctor(ctx *cli.Context) error { logger := log.GetLogger("doctorouter") defer logger.Close() - return doctor.RunChecks(logger, ctx.Bool("fix"), checks) + return doctor.RunChecks(stdCtx, logger, ctx.Bool("fix"), checks) } |