Reputation: 1176
Well, what I need to do actually is CTRL-Z out of a process that got started from insert mode in GVim
.
My command :Cdprun
executes cdprun.sh
which runs a sudo-ed daemon. I can add &
at the end of the sudo-ed daemon call to run in the background and that works but the user doesn't get prompted for a password. Instead I want to just CTRL-Z out of it but the keyboard interrupt doesn't work. Any ideas? Thx.
Upvotes: 3
Views: 381
Reputation: 53664
You generally have two options in this case: generic is using something like vim-addon-async mentioned by @Nicalas Martin or vim with built-in interpreters support: tcl with expect module, python with pyexpect, perl with Expect, maybe something else (note: all of the mentioned packages are not shipped with tcl/python/perl). Second is specific to current situation: it is backgrounding in the other place. From your explanation I guessed that you have a script looking like
#!/bin/sh
<...>
sudo run-daemon --daemon-args # Last executed line
, am I right? Than you can just put backgrounding in another place: not
sudo run-daemon --daemon-args &
, but
sudo sh -c "nohup run-daemon --daemon-args &"
Upvotes: 2
Reputation: 440
Here is a script to deal with asynchronous command in vim. Not a perfect solution but could be a good temporary solution. http://www.vim.org/scripts/script.php?script_id=3307
Upvotes: 0