From: gabriele renzi Date: 2004-10-10T11:19:40+09:00 Subject: Re: How to exit properly with a signal? Bob Proulx ha scritto: > How are signals properly handled in ruby? (I am new to ruby but > experienced with C, sh and perl.) > > Run, then interrupt it while it is in the sleep: > > sh -c 'sleep 10' ; echo $? > > 130 > > However, this same script in ruby is trapped by the ruby default > signal handler. > > ruby -e 'sleep 10' ; echo $? > -e:1:in `sleep': Interrupt from -e:1 > 1 > I guess you want: trap("INT") { puts "interrupted" }