From 834d47fedd68a5adbd6152649363d99b6ad642b4 Mon Sep 17 00:00:00 2001 From: "Kurt J. Bosch" Date: Sun, 3 Jul 2011 19:36:29 +0200 Subject: functions: Make status() return the actual exit code The exit code returned by the given command might be useful/expected, so don't discard but return it. --- functions | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'functions') diff --git a/functions b/functions index 202db30..6efcd52 100644 --- a/functions +++ b/functions @@ -156,12 +156,10 @@ stat_die() { status() { stat_busy "$1" shift - if "$@" &>/dev/null; then - stat_done - return 0 - fi - stat_fail - return 1 + "$@" &>/dev/null + local ret=$? + (( $ret == 0 )) && stat_done || stat_fail + return $ret } # usage : in_array( $needle, $haystack ) -- cgit v1.2.3