diff --git a/install-claude-code.sh b/install-claude-code.sh index ea2958e..fd2d8df 100755 --- a/install-claude-code.sh +++ b/install-claude-code.sh @@ -693,7 +693,10 @@ install_coding_helper() { if check_coding_helper_installed; then log_info "coding-helper already installed" echo "" - read -p "Launch coding-helper wizard now? [y/N] " -n 1 -r launch_helper < /dev/tty + # Temporarily disable set -e for read command + set +e + read -p "Launch coding-helper wizard now? [y/N] " -n 1 -r launch_helper < /dev/tty 2>/dev/null || launch_helper="N" + set -e echo "" if [[ $launch_helper =~ ^[Yy]$ ]]; then launch_coding_helper @@ -701,10 +704,12 @@ install_coding_helper() { return fi - # Install the helper + # Install the helper (temporarily disable set -e to capture errors) + set +e local install_output install_output=$(npm install -g @z_ai/coding-helper 2>&1) local install_exit_code=$? + set -e if [ $install_exit_code -eq 0 ]; then # Verify installation @@ -713,7 +718,9 @@ install_coding_helper() { echo "" echo -e "${CYAN}You can now run:${NC} ${YELLOW}npx @z_ai/coding-helper${NC}" echo "" - read -p "Launch coding-helper wizard now? [y/N] " -n 1 -r launch_helper < /dev/tty + set +e + read -p "Launch coding-helper wizard now? [y/N] " -n 1 -r launch_helper < /dev/tty 2>/dev/null || launch_helper="N" + set -e echo "" if [[ $launch_helper =~ ^[Yy]$ ]]; then launch_coding_helper @@ -751,7 +758,10 @@ install_coding_helper() { echo -e "${BOLD}${YELLOW}═══════════════════════════════════════════════════════════${NC}" echo -e "${BOLD} Try installing with sudo now?${NC} ${GREEN}[Y/n]${NC} ${BOLD}(recommended)${NC}" echo -e "${BOLD}${YELLOW}═══════════════════════════════════════════════════════════${NC}" - read -p " " -n 1 -r use_sudo < /dev/tty + # Temporarily disable set -e for read command + set +e + read -p " " -n 1 -r use_sudo < /dev/tty 2>/dev/null || use_sudo="Y" + set -e echo "" # Default to Yes if user just presses Enter if [[ -z "$use_sudo" ]] || [[ $use_sudo =~ ^[Yy]$ ]]; then @@ -761,7 +771,9 @@ install_coding_helper() { if npm list -g @z_ai/coding-helper &> /dev/null 2>&1; then log_success "coding-helper installed and verified with sudo!" echo "" - read -p "Launch coding-helper wizard now? [y/N] " -n 1 -r launch_helper < /dev/tty + set +e + read -p "Launch coding-helper wizard now? [y/N] " -n 1 -r launch_helper < /dev/tty 2>/dev/null || launch_helper="N" + set -e echo "" if [[ $launch_helper =~ ^[Yy]$ ]]; then launch_coding_helper