tags:

views:

66

answers:

1

When I Ctrl C my program on linux I often get output that looks similar to a stack-dump (a crash).

Can I catch the Ctrl-C signal and exit gracefully?

Thanks!

+5  A: 

You can trap signals with Kernel.trap:

trap('INT') do
  # exit gracefully
end
Theo
worked great. thanks!
Poul