Skip to content

Commit 904c247

Browse files
author
samarcher
committed
fix: redirect input from /dev/tty for interactive prompts to improve compatibility in non-interactive environments
1 parent 64984ba commit 904c247

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

install.sh

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,11 @@ request_dep_install() {
151151
echo "$dep_name is required but is not installed."
152152
echo "Detected OS: $os_name"
153153
echo ""
154-
read -r -p "Install $dep_name automatically? [Y/n]: " choice
154+
if [ -c /dev/tty ]; then
155+
read -r -p "Install $dep_name automatically? [Y/n]: " choice < /dev/tty
156+
else
157+
read -r -p "Install $dep_name automatically? [Y/n]: " choice
158+
fi
155159
case "$choice" in
156160
[nN]|[nN][oO])
157161
do_install=false
@@ -567,7 +571,11 @@ configure_arch_profile() {
567571
if [ "$YES_TO_ALL" = true ]; then
568572
log "Non-interactive mode: selecting normal profile"
569573
else
570-
read -r -p "Enter choice [1/2] (default: 1): " ARJAX_PROFILE_CHOICE
574+
if [ -c /dev/tty ]; then
575+
read -r -p "Enter choice [1/2] (default: 1): " ARJAX_PROFILE_CHOICE < /dev/tty
576+
else
577+
read -r -p "Enter choice [1/2] (default: 1): " ARJAX_PROFILE_CHOICE
578+
fi
571579
fi
572580

573581
local arjax_user_mode="normal"

0 commit comments

Comments
 (0)