comparison src/testdir/test_terminal.vim @ 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 d73d982499ae
children 12518b40c161
comparison
equal deleted inserted replaced
19839:95aa315cc31d 19840:9981509b665f
2534 let g:buf0 = term_start('sh', #{hidden: 1}) 2534 let g:buf0 = term_start('sh', #{hidden: 1})
2535 call popup_create(g:buf0, {}) 2535 call popup_create(g:buf0, {})
2536 let g:buf1 = term_start('sh', #{hidden: 1, term_finish: 'close'}) 2536 let g:buf1 = term_start('sh', #{hidden: 1, term_finish: 'close'})
2537 call popup_create(g:buf1, {}) 2537 call popup_create(g:buf1, {})
2538 let g:buf2 = term_start(['sh', '-c'], #{curwin: 1, exit_cb: function('TermExit')}) 2538 let g:buf2 = term_start(['sh', '-c'], #{curwin: 1, exit_cb: function('TermExit')})
2539 sleep 100m 2539 call term_wait(g:buf2, 100)
2540 call popup_close(win_getid()) 2540 call popup_close(win_getid())
2541 endfunc 2541 endfunc
2542 func TermExit(...) 2542 func TermExit(...)
2543 call term_sendkeys(bufnr('#'), "exit\<CR>") 2543 let altbuf = bufnr('#')
2544 call term_sendkeys(altbuf, "exit\<CR>")
2545 call term_wait(altbuf)
2544 call popup_close(win_getid()) 2546 call popup_close(win_getid())
2545 endfunc 2547 endfunc
2546 call OpenTerms() 2548 call OpenTerms()
2547 2549
2548 call term_sendkeys(g:buf0, "exit\<CR>") 2550 call term_sendkeys(g:buf0, "exit\<CR>")
2549 sleep 100m 2551 call term_wait(g:buf0, 100)
2550 exe g:buf0 .. 'bwipe!' 2552 exe g:buf0 .. 'bwipe!'
2551 set hidden& 2553 set hidden&
2552 endfunc 2554 endfunc