[PATCH v3 1/2] Add new function die_with_status

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

 



This function takes the exit code as a parameter.

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

Make the old die-function to use die_with_status for simpler
maintenance.

die no longer prints empty die messages, this is a changed behavior.

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

diff --git a/git-sh-setup.sh b/git-sh-setup.sh
index 94e26ed..1a91f6e 100644
--- a/git-sh-setup.sh
+++ b/git-sh-setup.sh
@@ -40,8 +40,16 @@ git_broken_path_fix () {
 # @@BROKEN_PATH_FIX@@
 
 die() {
-	echo >&2 "$@"
-	exit 1
+	die_with_status 1 $@
+}
+die_with_status() {
+	stat=$1
+	shift
+	if test ${#@} -gt 0
+	then
+		echo >&2 "$@"
+	fi
+	exit $stat
 }
 
 GIT_QUIET=
-- 
1.7.6.rc0.14.g4fc55

--
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]