title: Incorrect exit code in python when calling windows script
body: <p>I don't seem to be getting the correct exit code from subprocess.call on Windows.</p>
  
  <pre><code>import subprocess
  exit_code = subprocess.call(['ant.bat', 'fail'])
  print exit_code # prints 0
  </code></pre>
  
  <p>Doing the same thing on windows seems to return something other than 0</p>
  
  <pre><code>&gt; echo %errorlevel%
  0
  &gt; ant fail
  &gt; echo %errorlevel%
  1
  </code></pre>
  
  <p>Shouldn't the values from both calls give the same value? Am I doing something wrong?</p>
  
  <p>In the worst case, how do I check the value of %errorlevel% in my python script?</p>
  
  <p>UPDATE:</p>
  
  <p>I tried something like this to get the errorlevel value:</p>
  
  <pre><code>environment = os.environment.copy()
  cmd = subprocess.Popen(['ant.bat', 'fail'], env = environment)
  for key, value in environment.items():
      print '%s = %s' % (key, value)
  </code></pre>
  
  <p>However I do not see errorlevel in that dictionary (os.getenv['errorlevel'] also fails).</p>