On 3 February 2016, Bram Moolenaar <[email protected]> wrote:
>
> Lcd wrote:
>
> > On 3 February 2016, Danek Duvall <[email protected]> wrote:
> > [...]
> > > I think the most reliable thing to do here is to have a way to
> > > know the pid and kill it directly, but since ! goes through
> > > a shell, you don't have any way of knowing what the pid of
> > > test_channel.py is.
> >
> >     Or just make the server write its PID to a file with an unique
> > name.  This is still not ideal, but it's probably good enough for
> > tests.
>
> Like we do for the port number.  OK, that can work for now.  But we
> need job control functionality anyway.  We should use that once it's
> implemented.
>
> Vim can already start jobs, but currently always waits for them to
> finish (with "!cmd" or system("cmd")).  Should not be too difficult to
> run a job in the background and get its PID.  At least on Unix, not
> sure about MS-Windows.

    Sure, job control is long overdue, but IMO it wouldn't be simple.
Once you can put a process in background you need to be able to deal
with a table of background processes, and this means waitpid(), SIGCHLD
(perhaps mapped to an autocmd), kill(), timeouts, select(), pipes, the
full range of file redirections, and careful (OS-dependent) handling of
a pile of signals.

    That said, it would be a game changer.  People came up with things
like vimproc:

        https://github.com/Shougo/vimproc.vim

    And then vimproc's interface was found to be too low-level, so they
came up with quickrun, which builds over vimproc:

        https://github.com/thinca/vim-quickrun

    A simpler (but in many ways less satisfactory) aproach might be
dispatch:

        https://github.com/tpope/vim-dispatch

    There are other, somewhat less popular approches:

        https://github.com/idbrii/AsyncCommand
        https://github.com/xolox/vim-misc
        https://github.com/xolox/vim-shell

    And then there's NeoVim, which has an embedded terminal to deal with
all this. :)

    /lcd

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