Damien wrote:

> Le Mon, Apr 11, 2016 at 10:38:10PM +0200, Bram Moolenaar a écrit :
> > 
> > Hirohito Higashi wrote:
> > 
> > > I challenged.  But not done it.
> > > But Kiichi was done it with the screen or the tmux.
> > > Great.
> > > 
> > > https://github.com/vim/vim/compare/master...ichizok:fix-job-channel-gc.test
> > 
> > Interesting.  But this runs Vim in a separate terminal, which makes
> > debugging difficult.  And it depends on tmux or screen.  I think with
> > some changes in Vim we can do it more directly.
> 
> Hi
> 
> Perhaps a script like this.
> 
> ---
> if !has('timers') || !has('job')
>   finish
> end
> 
> let g:count = 0
> 
> function Init()
>   let g:job = job_start(['ls'])
>   let g:timer = timer_start(150, 'Handler', {'repeat': 42})
> endf
> 
> function Handler(...)
>   let g:count += 1
>   if g:count == 1
>     call garbagecollect()
>   elseif g:count == 2
>     unlet g:job
>   elseif g:count == 3
>     call garbagecollect()
>   else
>     call system('touch Xok')
>     qa!
>   end
> endf
> 
> auto VimEnter * :call Init()
> ---

When calling garbagecollect() it does not actually run yet, it sets a
flag that is checked in the main loop.  But when running tests we never
get back to the main loop, we exit before that.

We would need a version of garbagecollect() that works right away, but
that's tricky, any local variables need to be "marked".  Or we need to
somehow make a trip through the main loop and come back to the script.

-- 
hundred-and-one symptoms of being an internet addict:
263. You have more e-mail addresses than shorts.

 /// Bram Moolenaar -- [email protected] -- 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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Raspunde prin e-mail lui