Created
May 19, 2011 22:52
-
-
Save serverhorror/981985 to your computer and use it in GitHub Desktop.
This file contains 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
$ python | |
Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) | |
[GCC 4.2.1 (Apple Inc. build 5646)] on darwin | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> def f(): | |
... try: | |
... raw_input("Read something:") | |
... except KeyboardInterrupt: | |
... print "A SIGINT HAPPENED!" | |
... sys.exit(0) | |
... | |
>>> f() | |
Read something:A SIGINT HAPPENED! | |
$ echo $? | |
0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment