From d139fb5cd08a9bdee30e0735e9e795585036ce7b Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Fri, 3 Jan 2020 22:48:53 -0500 Subject: 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) https://github.com/vim/vim/commit/50948e4ac24314d5a70404bbc592ffc28755ad9f --- src/nvim/testdir/test_timers.vim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/nvim/testdir/test_timers.vim b/src/nvim/testdir/test_timers.vim index e4d9329ac6..6c336e6fa6 100644 --- a/src/nvim/testdir/test_timers.vim +++ b/src/nvim/testdir/test_timers.vim @@ -260,9 +260,11 @@ func Test_getchar_zero() return 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 c = 0 - while c == 0 + while c == 0 && reltimefloat(reltime(start)) < 0.2 let c = getchar(0) sleep 10m endwhile -- cgit