From: Tim Pease Date: 2007-09-17T04:20:51+09:00 Subject: Re: loop a program on exit? 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