Merge pull request #5627 from pdietl/regress-input-keys-race

Wait for the pane to echo the key before capturing in input-keys.sh
This commit is contained in:
Nicholas Marriott
2026-09-22 07:55:13 +01:00
committed by GitHub

View File

@@ -22,7 +22,19 @@ assert_key () {
clear-history -t$W \; \
send-keys -t$W "$key" 'EOL' || exit 1
actual_code=$($TMUX capturep -pt$W | \
# cat echoes the keys back asynchronously, so wait for the EOL marker
# to reach the pane instead of capturing straight away.
i=0
while [ $i -lt 50 ]; do
screen=$($TMUX capturep -pt$W)
case "$screen" in
*EOL*) break ;;
esac
i=$((i + 1))
sleep 0.1
done
actual_code=$(printf '%s\n' "$screen" | \
head -1 | \
sed -e 's/EOL.*$//')