From d6e308a10f90178dbaba2dab29032b8f6ecc848b Mon Sep 17 00:00:00 2001 From: Egor fureunoir Gorbunov Date: Wed, 3 Dec 2025 14:45:12 +0300 Subject: [PATCH] Features: 1) Add tty check for all interactive prompts to support non-interactive environments; 2) Provide fallback behavior for non-tty sessions. Fixes: 1) Ensure prompts do not stall in non-interactive sessions. Extra: 1) Minor adjustments to prompt messages for better clarity; 2) Refactor prompt logic for improved robustness. --- scripts/Unix/generate-environment-file.sh | 32 ++++++++++++++++++----- 1 file changed, 26 insertions(+), 6 deletions(-) diff --git a/scripts/Unix/generate-environment-file.sh b/scripts/Unix/generate-environment-file.sh index e3fe3061..eeac970d 100755 --- a/scripts/Unix/generate-environment-file.sh +++ b/scripts/Unix/generate-environment-file.sh @@ -8,8 +8,16 @@ get_random_hex() { } prompt_default() { - printf "Enter %s [%s]: " "$1" "$2" - read -r response + if [ -t 0 ]; then + printf "Enter %s [%s]: " "$1" "$2" + if read -r response &2 - printf "Press Enter to continue or Ctrl+C to abort" - read -r + if [ -t 0 ]; then + printf "Press Enter to continue or Ctrl+C to abort: " + read -r _ &2 + fi fi EVIBES_PROJECT_NAME=$(prompt_default EVIBES_PROJECT_NAME eVibes)