From 1a7a78a1f27bdf58e9921cc636375385840a2dc5 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Sun, 16 Jan 2022 17:30:07 -0700 Subject: [PATCH] cmd: Print error if fmt overwrite fails (fix #4524) --- cmd/commandfuncs.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index bc62f2814..ec56ab9c3 100644 --- a/cmd/commandfuncs.go +++ b/cmd/commandfuncs.go @@ -567,7 +567,7 @@ func cmdFmt(fl Flags) (int, error) { if fl.Bool("overwrite") { if err := os.WriteFile(formatCmdConfigFile, output, 0600); err != nil { - return caddy.ExitCodeFailedStartup, nil + return caddy.ExitCodeFailedStartup, fmt.Errorf("overwriting formatted file: %v", err) } } else { fmt.Print(string(output))