From a0f4e4e91cbbd387b4f55c4274c16b62a53edbc6 Mon Sep 17 00:00:00 2001 From: Matteo Landi Date: Wed, 21 Aug 2019 20:43:37 +0200 Subject: [PATCH] Wait for transmit buffer to be empty, before calling `ch_close_in` --- autoload/async/job.vim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/autoload/async/job.vim b/autoload/async/job.vim index 9640435..0d54bd4 100644 --- a/autoload/async/job.vim +++ b/autoload/async/job.vim @@ -212,7 +212,10 @@ function! s:job_send(jobid, data, close_stdin) abort call s:flush_vim_sendraw(a:jobid, v:null) endif if a:close_stdin - call ch_close_in(l:jobinfo.channel) + while len(l:jobinfo.buffer) != 0 + sleep 1m + endwhile + call ch_close_in(l:jobinfo.channel) endif endif endfunction