James McCoy wrote:

> On Mon, Apr 25, 2016 at 11:06:43PM +0200, Bram Moolenaar wrote:
> > 
> > Andrew Stewart wrote:
> > 
> > > This handler gets called just about immediately, as expected, but
> > > a:message is always 'DETACH', not the diff output.  And then a few
> > > seconds later the exit handler echoes its E906 error.
> > 
> > This works.  But the script should use "out_cb":
> > 
> >     func! OutHandler(channel, msg)
> >       echomsg a:msg
> >     endfunc
> >     let cmd = 'diff -u /tmp/a /tmp/b'
> >     let job = job_start(cmd, {'out_cb': 'OutHandler'})
> > 
> > The echo statements overwrite each other, "DETACH" is the last one.  Use
> > ":messages" to see what happened before this.
> 
> Why is Vim injecting "DETACH" into the output?  The netbeans code uses
> is because that's part of the established protocol, but why is that
> being imposed on every other user of channels?

Yeah, I was also wondering if we need it.  At least when there is a
close callback it doesn't make sense.

I would think that normally the job will send some terminator.
Otherwise, one can add a close callback if one needs to know the channel
is done reading.  Would there be any reason to add DETACH?

Previously the close callback didn't work properly.  I fixed that now.

> Also, the help implies that this is only done for channels representing
> a socket, not ones that are used for a simple job_start() with a process:
> 
>   On read error or ch_close(), when using a socket with RAW or NL mode, the
>   string "DETACH\n" is sent, if still possible.  The channel will then be
>   inactive.

The documentation is wrong.

-- 
The war between Emacs and Vi is over.  Vi has won with 3 to 1.
http://m.linuxjournal.com/files/linuxjournal.com/linuxjournal/articles/030/3044/3044s1.html

 /// 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