Yasuhiro Matsumoto wrote:

> On Sunday, September 4, 2016 at 11:19:35 PM UTC+9, Bram Moolenaar wrote:
> > Yasuhiro Matsumoto wrote:
> > 
> > > When the job exit immediately, channel->ch_to_be_closed will be TRUE
> > > before channel_read even though the output buffer is filled enough to
> > > read. For example, following command doesn't output result of the job.
> > > 
> > > ---------
> > > function! Disp(ch, msg)
> > >     echom a:msg
> > > endfunction
> > > 
> > > function! PerlCheck()
> > >     let s:job = job_start("perl -cw ".expand("%"), { "callback" : 
> > > function("Disp") })
> > > endfunction
> > > ---------
> > 
> > I cannot reproduce the problem.  Does this only happen on MS-Windows
> > perhaps?
> > 
> > > Below is a patch to fix this. This change doesn't break any tests.
> > > 
> > > https://gist.github.com/130f41a825ec72ccddb55b189d11558f
> > 
> > It looks like the change in channel_wait() is a no-op.
> > So the essential thing is to ignore ch_to_be_closed in channel_read().
> > Can you explain how we would get there with ch_to_be_closed set while
> > there is still something to read?  It should only happen after reading
> > failed.
> > 
> > Hmm, is it because PeekNamedPipe() returns zero but there is still
> > something to read?
> 
> Yes, Right. stdout/stdin/stderr is buffer(s). So can't ignore output
> even though the jo was exited.

Isn't the best solution then to have channel_wait() not return an error?
Or is there some way to detect the situation, perhaps by using
LastError().  At least it should only affect Windows, since on Unix we
don't want to make this exception.

-- 
hundred-and-one symptoms of being an internet addict:
164. You got out to buy software, instead of going out for a beer.

 /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net   \\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui