mirror of
https://github.com/neovim/neovim.git
synced 2025-10-06 09:56:31 +00:00
vim-patch:8.1.0844: when timer fails test will hang forever
Problem: When timer fails test will hang forever.
Solution: Use reltime() to limit waiting time. (Ozaki Kiichi, closes vim/vim#3878)
50948e4ac2
This commit is contained in:
@@ -260,9 +260,11 @@ func Test_getchar_zero()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
" Measure the elapsed time to avoid a hang when it fails.
|
||||||
|
let start = reltime()
|
||||||
let id = timer_start(20, {id -> feedkeys('x', 'L')})
|
let id = timer_start(20, {id -> feedkeys('x', 'L')})
|
||||||
let c = 0
|
let c = 0
|
||||||
while c == 0
|
while c == 0 && reltimefloat(reltime(start)) < 0.2
|
||||||
let c = getchar(0)
|
let c = getchar(0)
|
||||||
sleep 10m
|
sleep 10m
|
||||||
endwhile
|
endwhile
|
||||||
|
Reference in New Issue
Block a user