From 72a1ebdcbbc0b056d1a0c44c9fb83f52aa461868 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Fri, 19 Aug 2016 11:18:00 -0700 Subject: [PATCH] Fix error handling in download.sh This script should be deleted now that we can wget releases. --- tools/download.sh | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/tools/download.sh b/tools/download.sh index e37acf892..c705678e1 100755 --- a/tools/download.sh +++ b/tools/download.sh @@ -10,7 +10,6 @@ get_info() { case "$OSTYPE" in linux*) source /etc/os-release - echo $ID # Install curl and wget to download package case "$ID" in centos*) @@ -27,18 +26,21 @@ case "$OSTYPE" in version=ubuntu1.16.04.1_amd64.deb ;; *) - exit 2 >&2 "Ubuntu $VERSION_ID is not supported!" + echo "Ubuntu $VERSION_ID is not supported!" >&2 + exit 2 esac ;; *) - exit 2 >&2 "$NAME is not supported!" + echo "$NAME is not supported!" >&2 + exit 2 esac ;; darwin*) version=pkg ;; *) - exit 2 >&2 "$OSTYPE is not supported!" + echo "$OSTYPE is not supported!" >&2 + exit 2 ;; esac @@ -82,8 +84,9 @@ case "$OSTYPE" in esac powershell -noprofile -c '"Congratulations! PowerShell is installed at $PSHOME"' +success=$? -if [[ $? != 0 ]]; then - echo "ERROR! PowerShell didn't install. Check script output" - exit 1 +if [[ $success != 0 ]]; then + echo "ERROR! PowerShell didn't install. Check script output" >&2 + exit $success fi