Last active
August 16, 2016 00:15
-
-
Save jimbaker/7f260df8605fb156ae155800a383e357 to your computer and use it in GitHub Desktop.
Rebind sys.exit in Jython
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ~/jython2.7.0/bin/jython | |
Jython 2.7.0 (default:9987c746f838, Apr 29 2015, 02:25:11) | |
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0_75 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> import sys | |
>>> def f(*args): | |
... print "tried to exit %r" % (args,) | |
... | |
>>> sys.exit = f | |
>>> sys.exit(-1) | |
tried to exit (-1,) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment