IPython scripting - Exit script with status code
<p>I am trying to use ipython to script git pre-commit hooks since it has a nice syntax to run shell commands and converting the stdout result into a list of strings (which makes for easy processing).</p>

<p>I need to return a status code != 0 from the ipython script so that git pre-commit hook will abort the commit.</p>

<p>Consider this example script</p>

<pre><code>#! /bin/ipython
import sys
sys.exit(1)
</code></pre>

<p>running it from the shell</p>

<pre><code>$ ipython test.ipy
</code></pre>

<p>but then checking the status code with <code>$ echo $?</code> always returns <code>0</code></p>

<p>Is there a way to make ipython return a non-zero status code?</p>