Skip to content

Commit

Permalink
cmd: Print error if fmt overwrite fails (fix #4524)
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Jan 17, 2022
1 parent 1feb659 commit 1a7a78a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion cmd/commandfuncs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 1a7a78a

Please sign in to comment.