From: Ola Bini Date: 2006-07-17T18:51:13+09:00 Subject: Re: Catch ^c/signals? blocks? Elite Force wrote: > Hello, > > I'm kinda new to ruby and have a few questions. > > If i run a ruby script it can be interrupted with ^c or signals (e.g. > killall ruby"). Is it possible to catch those to do cleanup stuff before > exiting? > > Whats the difference between { ... } and do ... end? Are they both > blocks? When to use what? > > I'd really appreciate it if you could answer my questions, thanks. > I would recommend that you lookup either the method Kernel#trap, the class Signal, or maybe both? -- Ola Bini (http://ola-bini.blogspot.com) JvYAML, RbYAML, JRuby and Jatha contributor System Developer, Karolinska Institutet (http://www.ki.se) OLogix Consulting (http://www.ologix.com) "Yields falsehood when quined" yields falsehood when quined.