HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux ip-172-31-42-149 5.15.0-1084-aws #91~20.04.1-Ubuntu SMP Fri May 2 07:00:04 UTC 2025 aarch64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //home/ubuntu/.nvm/test/installation_node/install on bash with ERR trap and set -E
#!/bin/sh

set -e

cleanup() {
  nvm cache clear
  nvm deactivate
  rm -rf "${NVM_DIR}"/v*
  nvm unalias default
}

die() {
  echo "$@"
  cleanup || true
  exit 1
}

\. ../../nvm.sh

if [ -z "${BASH-}" ]; then
  echo "This test only applies to Bash; skipping"
  exit
fi

cleanup || true
trap 'echo "==> EXIT signal received (status: $?)"; cleanup' EXIT

# shellcheck disable=SC3047
trap 'echo "==> ERR signal received"; exit 1' ERR
# shellcheck disable=SC3041
set -E

# shellcheck disable=SC3045,SC3047
ERR_TRAP_EXPECTED="$(trap -p ERR)"

# Adding ` || die 'install failed'` implicitly disables error handling and
# prevents ERR trap execution, so for the purposes of this test, `nvm install`
# can't be part of another command or statement
nvm install node

case "$-" in
*E*)
  # shellcheck disable=SC3045,SC3047
  [ "$(trap -p ERR)" = "$ERR_TRAP_EXPECTED" ] ||
    die "ERR trap not restored after \"nvm install $VERSION\""
  ;;
*)
  die "errtrace not restored after \"nvm install $VERSION\""
  ;;
esac