This commit is contained in:
2026-06-19 11:21:31 +02:00
parent b3194e66e2
commit 003871b089
12 changed files with 46 additions and 103 deletions
+3 -3
View File
@@ -9,15 +9,15 @@ set -euo pipefail
QUERY_CODE=$(printf "\033[c")
# Set terminal to raw mode with timeout as 0.5s
stty_orig=$(stty -g)
trap 'stty "$stty_orig"' EXIT INT TERM HUP
stty_orig=$(stty -g < /dev/tty)
trap 'stty "$stty_orig" < /dev/tty' EXIT INT TERM HUP
stty -echo -icanon min 1 time 0
printf "%s" "$QUERY_CODE" >/dev/tty
response=""
while true; do
IFS= read -r -N 1 -t 0.3 char || {
IFS= read -r -N 1 -t 0.3 char < /dev/tty || {
[ -z "$char" ] && break
}