mirror of
https://github.com/tmux/tmux.git
synced 2026-10-10 12:14:43 +00:00
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:
@@ -22,7 +22,19 @@ assert_key () {
|
|||||||
clear-history -t$W \; \
|
clear-history -t$W \; \
|
||||||
send-keys -t$W "$key" 'EOL' || exit 1
|
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 | \
|
head -1 | \
|
||||||
sed -e 's/EOL.*$//')
|
sed -e 's/EOL.*$//')
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user