title: Checking exit code returned by a python function
body: <p>I have written a python function</p>
  
  <pre><code>def foo():
      if A:
          do something
      if B:
          exit(-1)
  
  if __name__ == "__main__":
      foo()
  </code></pre>
  
  <p>Is there any way to check the exit code returned by foo function? I am running it from windows shell.</p>