On Sat, Feb 23, 2013 at 3:06 AM, Eric Wong <normalperson / yhbt.net> wrote:
> "mperham (Mike Perham)" <mperham / gmail.com> wrote:
>> trap 'INT' do
>>   LOG.info "Hello"
>> end
>
> An ugly workaround I use is to spawn a thread inside trap:
>
> trap 'INT' do
>   Thread.new do
>     LOG.info "Hello"
>   end
> end

Um. this is safe.

btw, following is unsafe when 1.9.x. because trap safe th.join is a
new feature of 2.0.

trap 'INT' do
  t = Thread.new do
    LOG.info "Hello"
  end
  t.join
end

see http://bugs.ruby-lang.org/issues/6416

Hm.
Should we backport this fix to 1.9.3 too?