Mercurial > vim
comparison src/testdir/test_channel.vim @ 8761:f8707ec9efe4 v7.4.1669
commit https://github.com/vim/vim/commit/8b877ac38e96424a08a8b8eb713ef4b3cf0064be
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Mar 28 19:16:20 2016 +0200
patch 7.4.1669
Problem: When writing buffer lines to a pipe Vim may block.
Solution: Avoid blocking, write more lines later.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Mon, 28 Mar 2016 19:30:05 +0200 |
parents | df91c8263f04 |
children | 176647a751d7 |
comparison
equal
deleted
inserted
replaced
8760:e43830c12eb2 | 8761:f8707ec9efe4 |
---|---|
789 endif | 789 endif |
790 call ch_log('Test_pipe_from_buffer()') | 790 call ch_log('Test_pipe_from_buffer()') |
791 | 791 |
792 sp pipe-input | 792 sp pipe-input |
793 call setline(1, ['echo one', 'echo two', 'echo three']) | 793 call setline(1, ['echo one', 'echo two', 'echo three']) |
794 let options = {'in_io': 'buffer'} | 794 let options = {'in_io': 'buffer', 'block_write': 1} |
795 if a:use_name | 795 if a:use_name |
796 let options['in_name'] = 'pipe-input' | 796 let options['in_name'] = 'pipe-input' |
797 else | 797 else |
798 let options['in_buf'] = bufnr('%') | 798 let options['in_buf'] = bufnr('%') |
799 endif | 799 endif |
883 split pipe-input | 883 split pipe-input |
884 set buftype=nofile | 884 set buftype=nofile |
885 | 885 |
886 let job = job_start(s:python . " test_channel_pipe.py", | 886 let job = job_start(s:python . " test_channel_pipe.py", |
887 \ {'in_io': 'buffer', 'in_name': 'pipe-input', 'in_top': 0, | 887 \ {'in_io': 'buffer', 'in_name': 'pipe-input', 'in_top': 0, |
888 \ 'out_io': 'buffer', 'out_name': 'pipe-output'}) | 888 \ 'out_io': 'buffer', 'out_name': 'pipe-output', |
889 \ 'block_write': 1}) | |
889 call assert_equal("run", job_status(job)) | 890 call assert_equal("run", job_status(job)) |
890 try | 891 try |
891 exe "normal Gaecho hello\<CR>" | 892 exe "normal Gaecho hello\<CR>" |
892 exe bufwinnr('pipe-output') . "wincmd w" | 893 exe bufwinnr('pipe-output') . "wincmd w" |
893 call s:wait_for_last_line('hello', 0) | 894 call s:wait_for_last_line('hello', 0) |
918 split pipe-io | 919 split pipe-io |
919 set buftype=nofile | 920 set buftype=nofile |
920 | 921 |
921 let job = job_start(s:python . " test_channel_pipe.py", | 922 let job = job_start(s:python . " test_channel_pipe.py", |
922 \ {'in_io': 'buffer', 'in_name': 'pipe-io', 'in_top': 0, | 923 \ {'in_io': 'buffer', 'in_name': 'pipe-io', 'in_top': 0, |
923 \ 'out_io': 'buffer', 'out_name': 'pipe-io'}) | 924 \ 'out_io': 'buffer', 'out_name': 'pipe-io', |
925 \ 'block_write': 1}) | |
924 call assert_equal("run", job_status(job)) | 926 call assert_equal("run", job_status(job)) |
925 try | 927 try |
926 exe "normal Goecho hello\<CR>" | 928 exe "normal Goecho hello\<CR>" |
927 call s:wait_for_last_line('hello', 1) | 929 call s:wait_for_last_line('hello', 1) |
928 call assert_equal('hello', getline(line('$') - 1)) | 930 call assert_equal('hello', getline(line('$') - 1)) |