title: How to bypass the 0-255 range limit for sys.exit() in python?
body: <p>In python (on a Linux system), I'm launching a command using <code>os.system()</code> and retrieving the return code. If that return code is different from 0, I would like to make the program exit with that same return code. So I wrote:</p>
  
  <pre><code>ret = os.system(cmd)
  if ret != 0:
     print "exit with status %s" % ret
     sys.exit(ret)
  </code></pre>
  
  <p>When the return code is lower than 256, it works fine, but when it's greater than 255, the exit code used is 0. How can I make sys.exit() accept codes greater than 255?</p>
  
  <p>Edit: the limit is actually 255</p>
  
  <p>In fact, the <code>ret</code> variable receives 256, but <code>sys.exit()</code> fails to use it, so the program returns 0 instead. When I launch <code>cmd</code> manually, I see that it returns 1, not 256.</p>