mirror of
https://github.com/DeeJanuz/frametop.git
synced 2026-10-06 02:00:06 +02:00
Keep the installer's build steps from reading its answers
Commands run during the install (distrobox, ssh) read stdin, so answers typed ahead or piped in were swallowed and the questions fell back to their defaults. Only the questions read stdin now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
983773edbd
commit
932d41af6a
1 file changed
+5
-1
+5
-1
@@ -23,13 +23,17 @@ for arg in "$@"; do
|
||||
esac
|
||||
done
|
||||
|
||||
# Only the questions read from the terminal (or whatever stdin is); the build steps get
|
||||
# no input, so they can't swallow typed-ahead or piped answers.
|
||||
exec 3<&0 </dev/null
|
||||
|
||||
step() { printf '\n\033[1m== %s\033[0m\n' "$*"; }
|
||||
ask() { # ask "question" default(y|n)
|
||||
[ "$assume_yes" = 1 ] && [ "$2" = y ] && return 0
|
||||
[ "$assume_yes" = 1 ] && return 1
|
||||
local hint answer
|
||||
hint=$([ "$2" = y ] && echo "Y/n" || echo "y/N")
|
||||
read -r -p "$1 [$hint] " answer
|
||||
read -r -p "$1 [$hint] " answer <&3 || answer=
|
||||
answer=${answer:-$2}
|
||||
[[ $answer =~ ^[Yy] ]]
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user