Browse Source

[BRE-1063] Display error if curl fails by using -S (--show-error) (#396)

pull/389/head
Andy Pixley 4 months ago committed by GitHub
parent
commit
5528334871
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      bitwarden.sh

6
bitwarden.sh

@ -82,12 +82,14 @@ echo ""
# Functions # Functions
function downloadSelf() { function downloadSelf() {
if curl -L -s -w "http_code %{http_code}" -o $SCRIPT_PATH.1 $BITWARDEN_SCRIPT_URL | grep -q "^http_code 20[0-9]" if curl -L -s -S -w "http_code %{http_code}" -o $SCRIPT_PATH.1 $BITWARDEN_SCRIPT_URL | grep -q "^http_code 20[0-9]"
then then
mv -f $SCRIPT_PATH.1 $SCRIPT_PATH mv -f $SCRIPT_PATH.1 $SCRIPT_PATH
chmod u+x $SCRIPT_PATH chmod u+x $SCRIPT_PATH
else else
exit_code=$?
rm -f $SCRIPT_PATH.1 rm -f $SCRIPT_PATH.1
exit $exit_code
fi fi
} }
@ -99,7 +101,7 @@ function downloadRunFile() {
local tmp_script=$(mktemp) local tmp_script=$(mktemp)
run_file_status_code=$(curl -s -L -w "%{http_code}" -o $tmp_script $RUN_SCRIPT_URL) run_file_status_code=$(curl -s -S -L -w "%{http_code}" -o $tmp_script $RUN_SCRIPT_URL)
if echo "$run_file_status_code" | grep -q "^20[0-9]" if echo "$run_file_status_code" | grep -q "^20[0-9]"
then then
mv $tmp_script $SCRIPTS_DIR/run.sh mv $tmp_script $SCRIPTS_DIR/run.sh

Loading…
Cancel
Save