[RFC PATCH 1/2] sh-setup: Make die take the error code as param.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



die used to print all parameters and then exit with code 1. Now die
prints the first parameter and uses the optional second parameter as the
exit code. The default exit code is 1.

This allows scripts to control the exit code when they call die.

All current git-code only uses the first parameter of die today so this
change has no impact on them.

Signed-off-by: Fredrik Gustafsson <iveqy@xxxxxxxxx>
Mentored-by: Jens Lehmann <Jens.Lehmann@xxxxxx>
Mentored-by: Heiko Voigt <hvoigt@xxxxxxxxxx>
---
 git-sh-setup.sh |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index aa16b83..6aa6c59 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -40,7 +40,11 @@ git_broken_path_fix () {
 # @@BROKEN_PATH_FIX@@
 
 die() {
-	echo >&2 "$@"
+	echo >&2 "$1"
+	if test $2
+	then
+		exit $2
+	fi
 	exit 1
 }
 
-- 
1.7.5.1.219.ge2152.dirty

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]