From: "RubyTalk@..." Date: 2007-09-17T13:10:04+09:00 Subject: Re: loop a program on exit? END{ code } "Declares code to be called at the end of the program (when the interpreter quits)." Ruby In A Nutshell: page 29. I do have the first edition so could have changed. SbeckerIV On 9/16/07, Tim Pease wrote: > On 9/15/07, Michael Linfield wrote: > > i want to have a program restart when its closed via the X button on the > > window / terminal > > > > any ideas? > > -- > > Posted via http://www.ruby-forum.com/. > > > > at_exit {exec "ruby", $0, *ARGS} > > Should work on all platforms, but you will not get the original flags > to the ruby interpreter. You should register a signal handler to trap > SIGKILL or SIGTERM and do an exit! from the handler. This will prevent > the at_exit blocks from running. > > Blessings, > TwP > >