From 651370487d234bee3b4625f88128a260b0f2a9aa Mon Sep 17 00:00:00 2001 From: Jean Niklas L'orange Date: Mon, 11 Aug 2014 09:59:04 +0200 Subject: [PATCH] Fix grammar and print exit code from http client. --- bin/lein | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/bin/lein b/bin/lein index 00a2addd..12e27fa0 100755 --- a/bin/lein +++ b/bin/lein @@ -50,11 +50,11 @@ function add_path { } function download_failed_message { - echo "Failed to download $1" + echo "Failed to download $1 (exit code $2)" echo "It's possible your HTTP client's certificate store does not have the" echo "correct certificate authority needed. This is often caused by an" echo "out-of-date version of libssl. It's also possible that you're behind a" - echo "firewall haven't yet set HTTP_PROXY and HTTPS_PROXY." + echo "firewall and haven't set HTTP_PROXY and HTTPS_PROXY." } function self_install { @@ -67,12 +67,13 @@ function self_install { mkdir -p "$(dirname "$LEIN_JAR")" LEIN_URL="https://github.com/technomancy/leiningen/releases/download/$LEIN_VERSION/leiningen-$LEIN_VERSION-standalone.jar" $HTTP_CLIENT "$LEIN_JAR.pending" "$LEIN_URL" - if [ $? == 0 ]; then + local exit_code=$? + if [ $exit_code == 0 ]; then # TODO: checksum mv -f "$LEIN_JAR.pending" "$LEIN_JAR" else rm "$LEIN_JAR.pending" 2> /dev/null - download_failed_message "$LEIN_URL" + download_failed_message "$LEIN_URL" "$exit_code" exit 1 fi }