From e7715916febe3d1b43b907d3707c7f19bc06c0db Mon Sep 17 00:00:00 2001 From: Spencer Alger Date: Tue, 13 Jan 2015 18:05:46 -0700 Subject: [PATCH] include the crit command in jenkins build script --- scripts/jenkins.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/scripts/jenkins.sh b/scripts/jenkins.sh index 4c9f61145..ac77e09b0 100644 --- a/scripts/jenkins.sh +++ b/scripts/jenkins.sh @@ -20,6 +20,17 @@ function release_lock { echo "cleared lock file $lockpath" } +# execute a command, and exit if it fails +function crit { + $* + CODE=$? + if [[ $CODE -gt 0 ]]; then + echo "last command was critical, but it reported non-zero exit code $CODE"; + release_lock # clear any locks + exit $CODE; + fi +} + # install a specific version of Node and the latest version of NPM within that install function install_node { local version=$1 @@ -48,7 +59,6 @@ function install_node { fi } - get_lock install_node "$NODE_V" npm install