On 9/15/07, Michael Linfield <globyy3000 / hotmail.com> 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