Skip to content

Commit

Permalink
fix: error parsing arguments for handle_error (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
epiccurious authored Dec 22, 2023
1 parent c8644e6 commit 194d5d5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions nodebuilder
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ set -o nounset
set -o pipefail

log_error() {
echo "[$(date +'%Y-%m-%dT%H:%M:%S')]: ERROR $*" >&2
echo "[$(date +'%Y-%m-%dT%H:%M:%S')] ERROR: $*" >&2
}

# shellcheck disable=SC2317
Expand All @@ -26,11 +26,11 @@ handle_exit() {
# shellcheck disable=SC2317
handle_error() {
ensure_cursor_is_on_column_one
log_error "Command '$1 $2' failed at line $3."
log_error "Failed to run '${BASH_COMMAND}' on line $1."
}

trap handle_exit EXIT
trap 'handle_error ${LASTNO:-} ${BASH_COMMAND:-} ${LINENO:-}' ERR
trap 'handle_error ${LINENO:-}' ERR

target_bitcoin_version="26.0"
target_bitcoin_architecture="$(uname -m)"
Expand All @@ -41,8 +41,6 @@ user_data_dir="${XDG_DATA_HOME:-${HOME}/.local/share}"
shortcut_image_source="https://i.imgur.com/27V69CR.png"
shortcut_image_file="${user_data_dir}/images/bitcoin.png"

sleep_time="10"

(timeout --preserve-status 0.1 nc -z 1.1.1.1 53 &&
timeout --preserve-status 0.1 nc -z 8.8.8.8 53 &&
timeout --preserve-status 0.5 nc -z bitcoincore.org 443) || {
Expand Down Expand Up @@ -289,7 +287,6 @@ fi

echo -n "Starting Bitcoin Core... "
if [ "${CI:-false}" = true ]; then
echo -en "\n Starting bitcoind... "
bitcoind --daemonwait
else
bitcoin-qt 2> /dev/null &
Expand All @@ -300,6 +297,7 @@ echo -n " Checking the RPC status... "
bitcoin-cli --rpcwait getrpcinfo > /dev/null
echo "ok."

sleep_time="10"
blockchain_info=$(bitcoin-cli --rpcwait getblockchaininfo)
ibd_status=$(jq '.initialblockdownload' <<< "${blockchain_info}")

Expand Down

0 comments on commit 194d5d5

Please sign in to comment.