B
Bob Proulx
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
How may I have ruby's program exit code properly reflect to the caller
that it was terminated on a signal? And also how may I prevent the
default handler from printing extraneous information?
The perl version behaves as desired here similar to the shell version.
perl -e 'sleep 10' ; echo $?
130
I want to replace some existing programs with ruby equivalents.
I am using ruby 1.8.2 from Debian sid/unstable.
Thanks
Bob
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
How may I have ruby's program exit code properly reflect to the caller
that it was terminated on a signal? And also how may I prevent the
default handler from printing extraneous information?
The perl version behaves as desired here similar to the shell version.
perl -e 'sleep 10' ; echo $?
130
I want to replace some existing programs with ruby equivalents.
I am using ruby 1.8.2 from Debian sid/unstable.
Thanks
Bob