Skip to content

Commit 50948e4

Browse files
committed
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 #3878)
1 parent e0de216 commit 50948e4

2 files changed

Lines changed: 5 additions & 1 deletion

File tree

src/testdir/test_timers.vim

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,11 @@ func Test_getchar_zero()
257257
return
258258
endif
259259

260+
" Measure the elapsed time to avoid a hang when it fails.
261+
let start = reltime()
260262
let id = timer_start(20, {id -> feedkeys('x', 'L')})
261263
let c = 0
262-
while c == 0
264+
while c == 0 && reltimefloat(reltime(start)) < 0.2
263265
let c = getchar(0)
264266
sleep 10m
265267
endwhile

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,8 @@ static char *(features[]) =
783783

784784
static int included_patches[] =
785785
{ /* Add new patch number below this line */
786+
/**/
787+
844,
786788
/**/
787789
843,
788790
/**/

0 commit comments

Comments
 (0)