Files
SuperCharged-Claude-Code-Up…/install-claude-code.sh
uroma a380852c84 Fix: Prevent script exit due to set -e with read commands
Root Cause: The script has `set -e` which causes immediate exit when
any command fails. When npm install fails, the script exits before
showing the error message. Additionally, `read < /dev/tty` can fail
in WSL or certain terminal environments, causing silent script exit.

Solution: Wrap all read commands and npm install with `set +e`/`set -e`
to prevent premature exit:

1. npm install command (line 708-712):
   - Disables set -e before capturing output
   - Re-enables after getting exit code
   - Allows error handling to execute

2. All read commands with /dev/tty:
   - Wrapped with set +e / set -e
   - Added fallback defaults: || var="default"
   - Added 2>/dev/null to suppress read errors
   - Prevents exit if /dev/tty unavailable

3. Protected read locations:
   - Line 698: Launch wizard prompt (already installed case)
   - Line 722: Launch wizard prompt (success case)
   - Line 761: Sudo retry prompt (defaults to "Y")
   - Line 773: Launch wizard prompt (sudo success case)

This is critical for WSL users where /dev/tty may not work properly
with curl | bash execution.

Example fix:
```bash
# Before (exits on read failure):
read -p "Prompt? " -n 1 -r var < /dev/tty

# After (continues on read failure):
set +e
read -p "Prompt? " -n 1 -r var < /dev/tty 2>/dev/null || var="Y"
set -e
```

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-22 16:44:39 +00:00

37 KiB
Executable File