From 05152e3adec0691958aa68d20dfdb2246cc7c51a Mon Sep 17 00:00:00 2001 From: Jules Villard Date: Thu, 12 Apr 2018 03:35:05 -0700 Subject: [PATCH] [make] restore output of errors Summary: Lost in D7569054: because `-e` is set, the command to run needs to be wrapped a bit more carefully to continue the execution in case of failure and get to the part where we print the error messages on the console. Reviewed By: mbouaziz Differential Revision: D7599442 fbshipit-source-id: 65f6bf7 --- Makefile | 2 +- Makefile.config | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index f6045bc9f..af9b07fd5 100644 --- a/Makefile +++ b/Makefile @@ -285,7 +285,7 @@ ocaml_unit_test: test_build INFER_ARGS=--results-dir^infer-out-unit-tests $(BUILD_DIR)/test/inferunit.bc) define silence_make - $(1) 2> >(grep -v "warning: \(ignoring old\|overriding\) \(commands\|recipe\) for target") + $(1) 2> >(grep -v 'warning: \(ignoring old\|overriding\) \(commands\|recipe\) for target') endef .PHONY: $(DIRECT_TESTS:%=direct_%_test) diff --git a/Makefile.config b/Makefile.config index cd5d1e351..784ad0fb1 100644 --- a/Makefile.config +++ b/Makefile.config @@ -169,9 +169,10 @@ define silent_on_success "$$HUMAN_START_DATE" "$$HASH" "$(1)"; \ fi; \ $(MKDIR_P) $(ABSOLUTE_ROOT_DIR)/_build_logs; \ + ERRCODE=0; \ ($(2)) 1>$(ABSOLUTE_ROOT_DIR)/_build_logs/cmd-$$HASH.out \ - 2>$(ABSOLUTE_ROOT_DIR)/_build_logs/cmd-$$HASH.err; \ - ERRCODE=$$?; \ + 2>$(ABSOLUTE_ROOT_DIR)/_build_logs/cmd-$$HASH.err \ + || ERRCODE=$$?; \ if [ $$ERRCODE != 0 ]; then \ echo "$(TERM_ERROR)[*ERROR**][$$HASH] *** ERROR '$(1)'$(TERM_RESET)" >&2; \ echo "$(TERM_ERROR)[*ERROR**][$$HASH] *** command: '$(2)'$(TERM_RESET)" >&2; \ @@ -182,7 +183,7 @@ define silent_on_success echo "$(TERM_ERROR)[*ERROR**][$$HASH] *** stderr:$(TERM_RESET)" >&2; \ sed -e "s/^\(.*\)$$/$(TERM_ERROR)[*ERROR**][$$HASH]$(TERM_RESET) \1/" \ $(ABSOLUTE_ROOT_DIR)/_build_logs/cmd-$$HASH.err; >&2; \ - exit 1; \ + exit $$ERRCODE; \ elif [ -z $(SILENT) ]; then \ UNIX_END_DATE=$$(date +"%s"); \ printf '[%7ss][%$(MAX_PID_SIZE)s] $(TERM_SUCCESS)SUCCESS %s$(TERM_RESET)\n' \