Hi.   I'm trying to trap SIGINT when executing [long running] code
within embedded ruby but it appears that vim is internally swallowing
[with cleanup] but not letting vimscript or ruby catch the signal.
Without any trapping, the ruby code is terminated mid-stream so vim is
doing something... I just can't do my own handling.   Below are 2
attempts (failed).  Thoughts? Thx - dave (davidpthomas at gmail dot
com)

********* original code

function! s:foo
ruby << GOTRUBY
   SomeClass.new.do_something      # may run for 30sec; want to catch
interrupt
GOTRUBY
endfunction

******** attempt #1

function! s:foo
try
ruby << GOTRUBY
   SomeClass.new.do_something      # may run for 30sec; want to catch
interrupt
GOTRUBY
catch /^Vim:Interrupt$/
  echo 'all your base'
endtry
endfunction


******* attempt #2

function! s:foo
try
ruby << GOTRUBY
   Kernel.trap("INT", proc { raise "UserBored"} )
   SomeClass.new.do_something      # may run for 30sec; want to catch
interrupt
GOTRUBY
catch /UserBored/
  echo 'Go Get Beer'
catch /^Vim:Interrupt$/
  echo 'all your base'
endtry
endfunction

-- 
You received this message from the "vim_use" 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

Reply via email to