diff --git a/bpmodify/bpmodify.go b/bpmodify/bpmodify.go index 64ee56d..13811a4 100644 --- a/bpmodify/bpmodify.go +++ b/bpmodify/bpmodify.go @@ -223,12 +223,13 @@ func walkDir(path string) { } func main() { + defer func() { os.Exit(exitCode) }() + flag.Parse() if flag.NArg() == 0 { if *write { - fmt.Fprintln(os.Stderr, "error: cannot use -w with standard input") - exitCode = 2 + report(fmt.Errorf("error: cannot use -w with standard input")) return } if err := processFile("", os.Stdin, os.Stdout); err != nil {