How do I start a process in the background inside Gvim?
Well what I need to do CTRLis Zfrom the process that was started from insert mode into GVim
.
My command :Cdprun
is executing cdprun.sh
, which starts the sudo-ed daemon. I can add a &
sudo-ed daemon at the end of the call to run in the background and this works, but the user is not prompted for a password. Instead, I want to just CTRL- Zbut the keyboard interrupt doesn't work. Any ideas? thank.
source to share
In general you have two options: generic uses something like vim-addon-async mentioned by @Nicalas Martin or vim with built-in interpreter support: tcl with wait module, python with pyexpect, perl with Expect, maybe something else (note: all mentioned packages do not come with tcl / python / perl). Secondly, it depends on the current situation: it is based on something else. From your explanation, I guessed that you have a script similar to
#!/bin/sh
<...>
sudo run-daemon --daemon-args # Last executed line
right? Than you can just put the background image somewhere else: not
sudo run-daemon --daemon-args &
but
sudo sh -c "nohup run-daemon --daemon-args &"
source to share
Here is a script to work with an asynchronous command in vim. Not ideal, but might be a good workaround. http://www.vim.org/scripts/script.php?script_id=3307
source to share