Last active
December 16, 2015 22:59
-
-
Save supermomonga/5511135 to your computer and use it in GitHub Desktop.
vimproc#kill() test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Signal.trap(:QUIT) do | |
puts "QUIT signal sent." | |
exit 0 | |
end | |
puts "Signal.list['QUIT'] => #{Signal.list['QUIT']}" | |
puts "My pid is #{$$}\n" | |
loop do | |
puts 'I\'m alive!' | |
# print "\a" # bell | |
sleep 2 | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let s:script_path = substitute(substitute(expand('<sfile>'), '\.vim$', '.rb', ''), '\\', '/', 'g') | |
echo s:script_path | |
function! TestRun() | |
let s:pid = vimproc#popen2('ruby ' . s:script_path . ' 12345')['pid'] | |
echo 'launched. (pid:' . s:pid . ')' | |
endfunction | |
function! TestKill() | |
call vimproc#kill(s:pid, 3) | |
echo 'closed. (pid:' . s:pid . ')' | |
" debug for vimproc#kill | |
" kill seems make zombie process... | |
echo 'last errmsg : ' . vimproc#get_last_errmsg() | |
echo 'last status : ' . vimproc#get_last_status() | |
endfunction |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment