diff --git a/tools/build_protobuf b/tools/build_protobuf index 808ed4a3a..f081889ae 100755 --- a/tools/build_protobuf +++ b/tools/build_protobuf @@ -1,4 +1,5 @@ #!/usr/bin/env bash +set -e cd $(dirname $0)/.. PROTOB=common/protob @@ -71,6 +72,7 @@ do_rebuild() { do_check() { # rebuild protobuf in tmpdir and check result against specified directory local TMPDIR=$(mktemp -d proto-check.XXXXXX) + trap "rm -r $TMPDIR" RETURN local FILE_OR_DIR="$1" shift @@ -85,10 +87,7 @@ do_check() { fi do_rebuild "$FILE_OR_DIR" "$TMPDEST" "$@" - DIFF=$(diff -ur --exclude __pycache__ "$OUTPUT" "$TMPDEST") - rm -r "$TMPDIR" - if [ -n "$DIFF" ]; then - echo "$DIFF" + if ! diff -ur --exclude __pycache__ "$OUTPUT" "$TMPDEST"; then RETURN=1 fi }