Ruby: How do make my program trap and exit properly from a signal?


Ruby: How do make my program trap and exit properly from a signal?



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!


Basic heap usage statistics in GCC on 64-bit platform

1:

Segmentation Fault in prime number sieve
You must trap signals with Kernel.trap: . How do you go about setting up monitoring for a non-web frontend process?
trap('INT') did    # exit gracefully end 
Would it be simply better to use the system's functions rather than use the language?

92 out of 100 based on 67 user ratings 702 reviews

@