|
@@ -239,14 +239,15 @@ if [ ".$cmd_path" = . ]; then
|
|
|
exit 1
|
|
exit 1
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
-# execute command
|
|
|
|
|
|
|
+# execute command and save return code
|
|
|
eval "$cmd_shell $cmd_path \${1+\"\$@\"}"
|
|
eval "$cmd_shell $cmd_path \${1+\"\$@\"}"
|
|
|
|
|
+rc=$?
|
|
|
|
|
|
|
|
# execution result check and graceful termination
|
|
# execution result check and graceful termination
|
|
|
-if [ $? -ne 0 ]; then
|
|
|
|
|
- echo "openpkg:ERROR: Command \"$cmd\" failed (return code was $?)" 1>&2
|
|
|
|
|
- exit $?
|
|
|
|
|
-else
|
|
|
|
|
- exit 0
|
|
|
|
|
|
|
+if [ $rc -ne 0 ]; then
|
|
|
|
|
+ echo "openpkg:ERROR: Command \"$cmd\" failed (return code was $rc)" 1>&2
|
|
|
fi
|
|
fi
|
|
|
|
|
|
|
|
|
|
+# exit and pass cmd return code to caller
|
|
|
|
|
+exit $rc
|
|
|
|
|
+
|