From d6f857ffa8a1a933dac3e37dbd32b54b9028a5d9 Mon Sep 17 00:00:00 2001 From: catlog22 Date: Wed, 1 Oct 2025 22:31:33 +0800 Subject: [PATCH] fix: Display installation mode menu in Install-Claude.sh MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Redirect menu prompts to stderr to prevent capture by command substitution - Fixes issue where installation options were not visible to user - Menu now displays correctly: "Global" and "Path" installation modes Issue: When get_user_choice output was captured by $(command), the menu display was suppressed because stdout was being captured. Solution: Output all user-facing prompts to stderr (&2) while keeping the selected value on stdout for function return. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- Install-Claude.sh | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Install-Claude.sh b/Install-Claude.sh index 8dc0a2ef..717a7baa 100644 --- a/Install-Claude.sh +++ b/Install-Claude.sh @@ -119,19 +119,22 @@ function get_user_choice() { local default_index=0 if [ "$NON_INTERACTIVE" = true ]; then - write_color "Non-interactive mode: Using default '${options[$default_index]}'" "$COLOR_INFO" + write_color "Non-interactive mode: Using default '${options[$default_index]}'" "$COLOR_INFO" >&2 echo "${options[$default_index]}" return fi - echo "" - write_color "$prompt" "$COLOR_PROMPT" - echo "" + # Output prompts to stderr so they don't interfere with function return value + echo "" >&2 + write_color "$prompt" "$COLOR_PROMPT" >&2 + echo "" >&2 for i in "${!options[@]}"; do - echo " $((i + 1)). ${options[$i]}" + echo " $((i + 1)). ${options[$i]}" >&2 done + echo "" >&2 + while true; do read -p "Please select (1-${#options[@]}): " choice @@ -140,7 +143,7 @@ function get_user_choice() { return fi - write_color "Invalid selection. Please enter a number between 1 and ${#options[@]}" "$COLOR_WARNING" + write_color "Invalid selection. Please enter a number between 1 and ${#options[@]}" "$COLOR_WARNING" >&2 done }