Skip to content

Instantly share code, notes, and snippets.

@supermomonga
Last active December 16, 2015 22:59
Show Gist options
  • Save supermomonga/5511135 to your computer and use it in GitHub Desktop.
Save supermomonga/5511135 to your computer and use it in GitHub Desktop.
vimproc#kill() test
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
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