From 9033c957b95bd06736518c9d8f1d53e9c3be4567 Mon Sep 17 00:00:00 2001 From: Hunter Knepshield Date: Wed, 17 Feb 2021 20:21:42 -0800 Subject: [PATCH] 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 --- bpfmt/bpfmt.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bpfmt/bpfmt.go b/bpfmt/bpfmt.go index c287ea2..4e6bd1e 100644 --- a/bpfmt/bpfmt.go +++ b/bpfmt/bpfmt.go @@ -141,7 +141,7 @@ func main() { if err := processReader("", os.Stdin, os.Stdout); err != nil { report(err) } - return + os.Exit(exitCode) } for i := 0; i < flag.NArg(); i++ {