title: Exit jshell with error code
body: <p>How do I <code>/exit</code> a <a href="https://docs.oracle.com/javase/9/tools/jshell.htm" rel="noreferrer">jshell</a> session with a non-zero error code?</p>
  
  <ul>
  <li><code>/exit</code> yields: <em>Process finished with exit code 0</em></li>
  <li><code>/exit 1</code> yields: <em>Process finished with exit code 0</em></li>
  <li><code>throw new Error("1")</code> yields: <em>java.lang.Error thrown: 1 at (#24:1)` and Process finished with exit code 0</em></li>
  <li><code>System.exit(1)</code> yields: <em>State engine terminated. Restore definitions with: /reload -restore ... and the jshell session is not terminated.</em></li>
  </ul>
  
  <p>A bash command like <code>set -e</code> is not available.</p>