cmd: Use a factory to create the caddy root command (#6533)

Co-authored-by: Francis Lavoie <lavofr@gmail.com>
This commit is contained in:
a
2024-08-21 22:29:42 -05:00
committed by GitHub
parent 2bb2ecc549
commit 8ccfedf2bb
4 changed files with 96 additions and 60 deletions

View File

@@ -72,7 +72,7 @@ func Main() {
caddy.Log().Warn("failed to set GOMAXPROCS", zap.Error(err))
}
if err := rootCmd.Execute(); err != nil {
if err := defaultFactory.Build().Execute(); err != nil {
var exitError *exitError
if errors.As(err, &exitError) {
os.Exit(exitError.ExitCode)