The following code run on JRuby 9.1.17.0 and 9.2.13.0 on Windows:
at_exit { puts "at_exit function" }
ObjectSpace.define_finalizer("string", proc { puts "in finalizer" })
exit!
produces this:
at_exit function
in finalizer
My expectation was that the exit handlers should not have been called as per the documentation for exit!:
https://ruby-doc.org/core-2.7.1/Kernel.html#method-i-exit-21
Is this a bug in exit!?
Is there some other way that I can achieve the desired outcome of not firing exit handlers so that I can guarantee killing my system from the inside?