[PATCH 1/2] test-lib.sh: renamed die() to die_exit() and added generic die() function

Tomi Ollila tomi.ollila at iki.fi
Tue Apr 12 22:35:03 PDT 2016


The generic die function is now usable in future changes.
---
 test/test-lib.sh | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/test/test-lib.sh b/test/test-lib.sh
index ac04b15a96ba..5620b8cef553 100644
--- a/test/test-lib.sh
+++ b/test/test-lib.sh
@@ -229,7 +229,7 @@ _die_common () {
 	rm -rf "$TEST_TMPDIR"
 }
 
-die () {
+die_exit () {
 	_die_common
 	if test -n "$GIT_EXIT_OK"
 	then
@@ -250,10 +250,19 @@ die_signal () {
 	exit $code
 }
 
+die () {
+	_die_common
+	say_color error '%-6s' FATAL
+	echo " $*"
+	echo
+	echo "Unexpected exit while executing $0."
+	exit 1
+}
+
 GIT_EXIT_OK=
 # Note: TEST_TMPDIR *NOT* exported!
 TEST_TMPDIR=$(mktemp -d "${TMPDIR:-/tmp}/notmuch-test-$$.XXXXXX")
-trap 'die' EXIT
+trap 'die_exit' EXIT
 trap 'die_signal' HUP INT TERM
 
 test_decode_color () {
-- 
2.6.4



More information about the notmuch mailing list