Browse Source

cmd: Print error if fmt overwrite fails (fix #4524)

master
Matthew Holt 3 years ago
parent
commit
1a7a78a1f2
No known key found for this signature in database GPG Key ID: 2A349DD577D586A5
  1. 2
      cmd/commandfuncs.go

2
cmd/commandfuncs.go

@ -567,7 +567,7 @@ func cmdFmt(fl Flags) (int, error) {
if fl.Bool("overwrite") { if fl.Bool("overwrite") {
if err := os.WriteFile(formatCmdConfigFile, output, 0600); err != nil { if err := os.WriteFile(formatCmdConfigFile, output, 0600); err != nil {
return caddy.ExitCodeFailedStartup, nil return caddy.ExitCodeFailedStartup, fmt.Errorf("overwriting formatted file: %v", err)
} }
} else { } else {
fmt.Print(string(output)) fmt.Print(string(output))

Loading…
Cancel
Save