Ramel Eshed wrote:

> On Sunday, August 28, 2016 at 11:36:33 PM UTC+3, Bram Moolenaar wrote:
> > Ramel Eshed wrote:
> > 
> > > Of course, I've measured the time from job_start to close_cb. You can see
> > > this comparison in the example I've attached earlier in this thread.
> > 
> > Hmm, it's possible that detecting that the other end closed the pipe
> > happens much sooner than detecting that the child process has ended.
> > If that is the case I don't think there is a way around that.
> > 
> > 
> > -- 
> > hundred-and-one symptoms of being an internet addict:
> > 96. On Super Bowl Sunday, you followed the score by going to the
> >     Yahoo main page instead of turning on the TV.
> > 
> >  /// 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    ///
> 
> Well, I didn't think something like this could work but it did:
> 
> func! System(cmd)
>     let out = []
>     let job = job_start(['/bin/sh', '-c', a:cmd],
>                 \ {'out_cb': {c, msg -> add(out, msg)}})
>     let ch = job_getchannel(job)
>     while ch_status(ch) != 'closed'
>         sleep 10m
>     endwhile
>     return out
> endfunc
> 
> Maybe it should be done the same way in the C system() implementation...

This requires more investigation.  There is also code to still read from
the pipe after the child process exits, thus it is possible that not
being able to read is sufficient to stop waiting for the child.  Except
when we want the exit code.

-- 
hundred-and-one symptoms of being an internet addict:
99. The hum of a cooling fan and the click of keys is comforting to you.

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