update
This commit is contained in:
@@ -36,8 +36,8 @@ ITERM2_EXPECTED_RESPONSE=$(printf "\033]1337;") # followed by "ReportCellSize=..
|
||||
FENCE_CODE=$(printf "\033[c")
|
||||
|
||||
# Set terminal to raw mode with timeout
|
||||
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%s%s" "$ITERM2_QUERY_CODE" "$KGP_QUERY_CODE" "$FENCE_CODE" > /dev/tty
|
||||
@@ -48,7 +48,7 @@ support_sixel=0
|
||||
|
||||
response=""
|
||||
while true; do
|
||||
IFS= read -r -N 1 -t "$TIMEOUT" char || {
|
||||
IFS= read -r -N 1 -t "$TIMEOUT" char < /dev/tty || {
|
||||
[ -z "$char" ] && break
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,8 @@ EXPECTED_RESPONSE=$(printf "\033]1337;") # followed by "ReportCellSize=...", but
|
||||
FENCE_CODE=$(printf "\033[c")
|
||||
|
||||
# Set terminal to raw mode
|
||||
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%s" "$QUERY_CODE" "$FENCE_CODE" > /dev/tty
|
||||
@@ -23,7 +23,7 @@ printf "%s%s" "$QUERY_CODE" "$FENCE_CODE" > /dev/tty
|
||||
response=""
|
||||
ret=1
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -17,8 +17,8 @@ EXPECTED_RESPONSE=$(printf "\033_Gi=%d;OK\033\\" "$QUERY_ID")
|
||||
FENCE_CODE=$(printf "\033[c")
|
||||
|
||||
# Set terminal to raw mode with timeout
|
||||
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%s" "$QUERY_CODE" "$FENCE_CODE" > /dev/tty
|
||||
@@ -26,7 +26,7 @@ printf "%s%s" "$QUERY_CODE" "$FENCE_CODE" > /dev/tty
|
||||
response=""
|
||||
ret=1
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user