Mercurial > vim
changeset 19840:9981509b665f v8.2.0476
patch 8.2.0476: terminal nasty callback test fails sometimes
Commit: https://github.com/vim/vim/commit/52ea92b19d2bc992dd4570add64c12d98eab9db2
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Mar 29 17:50:48 2020 +0200
patch 8.2.0476: terminal nasty callback test fails sometimes
Problem: Terminal nasty callback test fails sometimes.
Solution: use term_wait() instead of a sleep. (Yee Cheng Chin,closes https://github.com/vim/vim/issues/5865)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 29 Mar 2020 18:00:04 +0200 |
parents | 95aa315cc31d |
children | ff9fa9cc6e2e |
files | src/testdir/test_terminal.vim src/version.c |
diffstat | 2 files changed, 7 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -2536,17 +2536,19 @@ func Test_term_nasty_callback() let g:buf1 = term_start('sh', #{hidden: 1, term_finish: 'close'}) call popup_create(g:buf1, {}) let g:buf2 = term_start(['sh', '-c'], #{curwin: 1, exit_cb: function('TermExit')}) - sleep 100m + call term_wait(g:buf2, 100) call popup_close(win_getid()) endfunc func TermExit(...) - call term_sendkeys(bufnr('#'), "exit\<CR>") + let altbuf = bufnr('#') + call term_sendkeys(altbuf, "exit\<CR>") + call term_wait(altbuf) call popup_close(win_getid()) endfunc call OpenTerms() call term_sendkeys(g:buf0, "exit\<CR>") - sleep 100m + call term_wait(g:buf0, 100) exe g:buf0 .. 'bwipe!' set hidden& endfunc