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:
Jan Edmund Lazo
2020-01-03 22:48:53 -05:00
parent 25613fa65b
commit d139fb5cd0

View File

@@ -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