Guest User

Untitled

a guest
Jan 16th, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. $ python yourscript.py
  2. $ echo $? # this will echo the sys.exit value
  3.  
  4. system("python yourscript.py");
  5.  
  6. if ($? == -1) {
  7. print "failed to execute: $!n";
  8. }
  9. elsif ($? & 127) {
  10. printf "child died with signal %d, %s coredumpn",
  11. ($? & 127), ($? & 128) ? 'with' : 'without';
  12. }
  13. else {
  14. printf "child exited with value %dn", $? >> 8;
  15. }
  16.  
  17. CMDPROMPT>python
  18. Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win 32
  19. Type "help", "copyright", "credits" or "license" for more information.
  20. >>> import sys
  21. >>> sys.exit(-1)
  22. CMDPROMPT>echo %ERRORLEVEL%
  23. -1
  24. CMDPROMPT>python
  25. Python 2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit (AMD64)] on win 32
  26. Type "help", "copyright", "credits" or "license" for more information.
  27. >>> import sys
  28. >>> sys.exit(0)
  29. CMDPROMPT>echo %ERRORLEVEL%
  30. 0
  31. CMDPROMPT>
Add Comment
Please, Sign In to add comment