Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $ python yourscript.py
- $ echo $? # this will echo the sys.exit value
- system("python yourscript.py");
- if ($? == -1) {
- print "failed to execute: $!n";
- }
- elsif ($? & 127) {
- printf "child died with signal %d, %s coredumpn",
- ($? & 127), ($? & 128) ? 'with' : 'without';
- }
- else {
- printf "child exited with value %dn", $? >> 8;
- }
- CMDPROMPT>python
- Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win 32
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import sys
- >>> sys.exit(-1)
- CMDPROMPT>echo %ERRORLEVEL%
- -1
- CMDPROMPT>python
- Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win 32
- Type "help", "copyright", "credits" or "license" for more information.
- >>> import sys
- >>> sys.exit(0)
- CMDPROMPT>echo %ERRORLEVEL%
- 0
- CMDPROMPT>
Add Comment
Please, Sign In to add comment