2 Commits

Author SHA1 Message Date
google-labs-jules[bot]
9ab6fd5a44 Fix: Simplify input prompts in setup script
Reverts input functions to a simpler model by separating the
`echo` of the prompt from the `read` command itself.
This avoids using `read -p` with complex, colorized prompt strings,
which can sometimes cause issues in specific terminal emulators or
compatibility layers like those found in MobaXterm.

This change aims to improve robustness of input handling by:
1. Using `echo -e -n` for displaying the prompt with colors.
2. Using a plain `read` or `read -s` for capturing user input.

This is a further attempt to resolve issues where users might be
unable to type or paste into prompts within the MobaXterm environment.
2025-06-20 09:42:11 +00:00
google-labs-jules[bot]
3d433ba1d7 Fix: Ensure setup script reads from /dev/tty for input
When stdin is not a terminal (e.g., in some script execution
contexts or if redirected), the `read` command may fail to capture
user input. This change modifies the input prompting functions
(`_prompt_user` and `_prompt_user_sensitive`) to explicitly
read from `/dev/tty` if stdin is not a terminal but `/dev/tty`
is available.

This should resolve issues where users are unable to type or paste
input during the setup process, particularly when selecting the
Docker approach and being prompted for API hash or other credentials.
2025-06-20 09:25:30 +00:00

View File

@@ -76,16 +76,19 @@ _check_python_version() {
_prompt_user() {
local prompt_message="$1"
local var_name="$2"
local default_value="${3:-}" # Use bash specific default value assignment
local current_value="${!var_name:-$default_value}" # Get current value of var_name or default
local default_value="${3:-}"
local input
# Echo the prompt using color codes
if [ -n "$default_value" ]; then
read -p "$(echo -e "${YELLOW}$prompt_message${NC} [Default: $default_value]: ")" input
echo -e -n "${YELLOW}${prompt_message}${NC} [Default: $default_value]: "
else
read -p "$(echo -e "${YELLOW}$prompt_message${NC}: ")" input
echo -e -n "${YELLOW}${prompt_message}${NC}: "
fi
# Read the input
read input
if [ -z "$input" ] && [ -n "$default_value" ]; then
eval "$var_name=\"$default_value\""
else
@@ -98,8 +101,13 @@ _prompt_user_sensitive() {
local var_name="$2"
local input
read -sp "$(echo -e "${YELLOW}$prompt_message${NC}: ")" input
# Echo the prompt using color codes
echo -e -n "${YELLOW}${prompt_message}${NC}: "
# Read the input silently
read -s input
echo # Newline after sensitive input
eval "$var_name=\"$input\""
}