title: Cleanly stop a running JRuby scriptlet
body: <p>I am running a Ruby script from Java using JRuby like so:</p>
  
  <pre><code>public class ScriptletRunnable implements Runnable {
      @Override
      public void run() {
          ScriptingContainer scriptingContainer = new ScriptingContainer();
          scriptingContainer.runScriptlet(/*My script*/); // this is a blocking call, never returns
      }
  }
  </code></pre>
  
  <p>I pass this runnable to a new thread and start the thread. When I want to stop the script from running, I can't seem to find any way to tell the <code>ScriptingContainer</code> to stop executing the script. Even if I make it a member and call <code>terminate()</code> on it, the script just doesn't stop. If you run the script from the command line you can cleanly shut it down with <code>Ctrl+C</code>. There must be a way to achieve this with JRuby.</p>