Alexey Verkhovsky wrote:
>>  4) the optional ability to have it display the whole backtrace on
>>  uncaught exceptions (and also for all existing threads).
> Not sure if anyone has mentioned that already, but this is simply a
> matter of either changing TRACE_HEAD and TRACE_TAIL #defines, and
> recompiling Ruby, or wrapping your "main" in something like
> 
> begin
>   ...
> rescue Object => e
>   puts e.message
>   print '  '
>   puts e.backtrace.join("\n  ")
>   exit -1
> end

Note that $! (which contains the current exception) is still defined
when Ruby is about to exit on an exception, while it's processing the
END blocks. You can get the same effect without wrapping main by adding
your exception printing code in an END block, which can be anywhere:

END { puts $!.backtrace*"\n\t" }

Clifford Heath.