Skip to content

Instantly share code, notes, and snippets.

@serverhorror
Created May 19, 2011 22:52
Show Gist options
  • Save serverhorror/981985 to your computer and use it in GitHub Desktop.
Save serverhorror/981985 to your computer and use it in GitHub Desktop.
$ 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