diff --git a/src/org/jruby/Ruby.java b/src/org/jruby/Ruby.java index b861225..89b97d1 100644 --- a/src/org/jruby/Ruby.java +++ b/src/org/jruby/Ruby.java @@ -2723,6 +2723,10 @@ public final class Ruby { } } + public void tearDown() { + tearDown(true); + } + /** * Make sure Kernel#at_exit procs get invoked on runtime shutdown. * This method needs to be explicitly called to work properly. @@ -2731,7 +2735,7 @@ public final class Ruby { * time Ruby is going away. This method can contain any other * things that need to be cleaned up at shutdown. */ - public void tearDown() { + public void tearDown(boolean systemExit) { int status = 0; while (!atExitBlocks.empty()) { @@ -2786,7 +2790,7 @@ public final class Ruby { getBeanManager().unregisterClassCache(); getBeanManager().unregisterMethodCache(); - if (status != 0) { + if (systemExit && status != 0) { throw newSystemExit(status); } } diff --git a/src/org/jruby/embed/ScriptingContainer.java b/src/org/jruby/embed/ScriptingContainer.java index b8f751f..80e16b3 100644 --- a/src/org/jruby/embed/ScriptingContainer.java +++ b/src/org/jruby/embed/ScriptingContainer.java @@ -1640,6 +1640,6 @@ public class ScriptingContainer implements EmbedRubyInstanceConfigAdapter { } public void terminate() { - getProvider().getRuntime().tearDown(); + getProvider().getRuntime().tearDown(false); } } \ No newline at end of file