Mercurial > vim
diff src/testdir/test_channel.vim @ 9007:d5c6f1c5cd28 v7.4.1789
commit https://github.com/vim/vim/commit/437905c25d4cedfa16d0f87392e4a000d22362b7
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Apr 26 19:01:05 2016 +0200
patch 7.4.1789
Problem: Cannot use ch_read() in the close callback.
Solution: Do not discard the channel if there is readahead. Do not discard
readahead if there is a close callback.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 26 Apr 2016 19:15:06 +0200 |
parents | 072556995a8e |
children | 5abf6f38cbbb |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -1080,6 +1080,28 @@ func Test_out_close_cb() endtry endfunc +func Test_read_in_close_cb() + if !has('job') + return + endif + call ch_log('Test_read_in_close_cb()') + + let s:received = '' + func! CloseHandler(chan) + let s:received = ch_read(a:chan) + endfunc + let job = job_start(s:python . " test_channel_pipe.py quit now", + \ {'close_cb': 'CloseHandler'}) + call assert_equal("run", job_status(job)) + try + call s:waitFor('s:received != ""') + call assert_equal('quit', s:received) + finally + call job_stop(job) + delfunc CloseHandler + endtry +endfunc + """""""""" let s:unletResponse = ''