From: KOSAKI Motohiro Date: 2013-02-23T17:17:58+09:00 Subject: [ruby-core:52734] Re: [ruby-trunk - Bug #7917][Open] Can't write to a Logger in a signal handler On Sat, Feb 23, 2013 at 3:06 AM, Eric Wong wrote: > "mperham (Mike Perham)" 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?