From: Eric S. Raymond Date: Tue, 19 Oct 2010 09:53:59 +0000 (-0400) Subject: Exit gracefully on keyboard interrupt. X-Git-Tag: 1.1~1 X-Git-Url: http://thyrsus.com/gitweb/?a=commitdiff_plain;h=e672ffaf799bac59bfa420144968bedbb37b632d;p=ctopy.git Exit gracefully on keyboard interrupt. --- diff --git a/ctopy b/ctopy index 2a380a1..98f11b0 100755 --- a/ctopy +++ b/ctopy @@ -1302,10 +1302,13 @@ if __name__ == "__main__": elif (switch == '-t'): shorthands["type"] += r"|\b" + val + r"\b" - code = sys.stdin.read() - if debug >= 2: - print "Input is: %s" % `code` - text = ctopy(code) - if debug: - print "Output:" - sys.stdout.write(text) + try: + code = sys.stdin.read() + if debug >= 2: + print "Input is: %s" % `code` + text = ctopy(code) + if debug: + print "Output:" + sys.stdout.write(text) + except KeyboardInterrupt: + pass