[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
master
Jules Villard 7 years ago committed by Facebook Github Bot
parent f1bcb91542
commit 05152e3ade

@ -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)

@ -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' \

Loading…
Cancel
Save