Mercurial > vim
diff src/testdir/test_channel.vim @ 8491:daebcbd87bd3 v7.4.1536
commit https://github.com/vim/vim/commit/de27989157f35172b25f9e01e0c147ed8f6ae3ce
Author: Bram Moolenaar <Bram@vim.org>
Date: Fri Mar 11 22:19:44 2016 +0100
patch 7.4.1536
Problem: Cannot re-use a channel for another job.
Solution: Add the "channel" option to job_start().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Fri, 11 Mar 2016 22:30:04 +0100 |
parents | c08c6d19db4d |
children | 1227dc21865b |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -917,6 +917,33 @@ func Test_pipe_null() call job_stop(job) endfunc +func Test_reuse_channel() + if !has('job') + return + endif + call ch_log('Test_reuse_channel()') + + let job = job_start(s:python . " test_channel_pipe.py") + call assert_equal("run", job_status(job)) + let handle = job_getchannel(job) + try + call ch_sendraw(handle, "echo something\n") + call assert_equal("something", ch_readraw(handle)) + finally + call job_stop(job) + endtry + + let job = job_start(s:python . " test_channel_pipe.py", {'channel': handle}) + call assert_equal("run", job_status(job)) + let handle = job_getchannel(job) + try + call ch_sendraw(handle, "echo again\n") + call assert_equal("again", ch_readraw(handle)) + finally + call job_stop(job) + endtry +endfunc + """""""""" let s:unletResponse = ''