Mercurial > vim
diff src/testdir/test_terminal.vim @ 26217:d25c0b0aad7d v8.2.3640
patch 8.2.3640: freeze when calling term_wait() in a close callback
Commit: https://github.com/vim/vim/commit/eea32afdb83ae281a63152f7494f79ec7e45ff55
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Nov 21 14:51:13 2021 +0000
patch 8.2.3640: freeze when calling term_wait() in a close callback
Problem: Freeze when calling term_wait() in a close callback.
Solution: Set a "closing" flag to tell term_wait() to return. (closes https://github.com/vim/vim/issues/9152)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sun, 21 Nov 2021 16:00:04 +0100 |
parents | 582218dbc6b3 |
children | 3af56224dca6 |
line wrap: on
line diff
--- a/src/testdir/test_terminal.vim +++ b/src/testdir/test_terminal.vim @@ -2058,5 +2058,22 @@ func Test_terminal_adds_jump() bwipe! endfunc +func Close_cb(ch, ctx) + call term_wait(a:ctx.bufnr) + let g:close_done = 'done' +endfunc + +func Test_term_wait_in_close_cb() + let g:close_done = '' + let ctx = {} + let ctx.bufnr = term_start('echo "HELLO WORLD"', + \ {'close_cb': {ch -> Close_cb(ch, ctx)}}) + + call WaitForAssert({-> assert_equal("done", g:close_done)}) + + unlet g:close_done + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab