Make bpfmt use exit codes even when reading from stdin.

Previously, an incantation like `bpfmt -o <$BAD_BP` would print to
stderr as expected, but then it would exit with 0. This is different
than the behavior of `bpfmt -o $BAD_BP`, which correctly exits with a
non-zero status code (in addition to printing the issues to stderr).

Test: m bpfmt; out/soong/host/linux-x86/bin/bpfmt -o <$BAD_BP; echo $?
Change-Id: I0a970cddf94fbd818525f9167d9113086b023c81
This commit is contained in:
Hunter Knepshield 2021-02-17 20:21:42 -08:00
parent e980b25b95
commit 9033c957b9

View file

@ -141,7 +141,7 @@ func main() {
if err := processReader("<standard input>", os.Stdin, os.Stdout); err != nil {
report(err)
}
return
os.Exit(exitCode)
}
for i := 0; i < flag.NArg(); i++ {