Merge pull request #290 from silverneko/bpmodify-exitcode

bpmodify: respect exitCode
This commit is contained in:
Dan Willemsen 2020-03-04 20:59:31 -08:00 committed by GitHub
commit aa919ddcbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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("<standard input>", os.Stdin, os.Stdout); err != nil {