Mercurial > vim
diff src/testdir/test_channel.vim @ 10259:a09db7a4afe0 v8.0.0027
commit https://github.com/vim/vim/commit/dc0ccaee68ca24d10050117fbec757ad33590a17
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Oct 9 17:28:01 2016 +0200
patch 8.0.0027
Problem: A channel is closed when reading on stderr or stdout fails, but
there may still be something to read on another part.
Solution: Turn ch_to_be_closed into a bitfield. (Ozaki Kiichi)
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 09 Oct 2016 17:30:04 +0200 |
parents | 920c73a27dda |
children | c5c15c818bda |
line wrap: on
line diff
--- a/src/testdir/test_channel.vim +++ b/src/testdir/test_channel.vim @@ -1505,6 +1505,23 @@ func Test_read_nonl_line() call assert_equal(3, g:linecount) endfunc +func Test_read_from_terminated_job() + if !has('job') + return + endif + + let g:linecount = 0 + if has('win32') + " workaround: 'shellescape' does improper escaping double quotes + let arg = 'import os,sys;os.close(1);sys.stderr.write(\"test\n\")' + else + let arg = 'import os,sys;os.close(1);sys.stderr.write("test\n")' + endif + call job_start([s:python, '-c', arg], {'callback': 'MyLineCountCb'}) + call WaitFor('1 <= g:linecount') + call assert_equal(1, g:linecount) +endfunc + function Ch_test_close_lambda(port) let handle = ch_open('localhost:' . a:port, s:chopt) if ch_status(handle) == "fail"