Commits

Anonymous committed daf3e2e

pressing Ctr+C now doesn't produce a traceback

  • Participants
  • Parent commits 4ebe265
  • Tags v0.3.3

Comments (0)

Files changed (4)

File scripts/gzip-wrapper.sh

Binary file modified.

File src/helpers.py

 
-import os, sys, unicodedata, codecs
+import os, sys, unicodedata, codecs, signal
+from functools import wraps
 import version
 
 def print_version():
 
 def safe_min(collection, fallback = int(2 ** 31 - 1)):
     return _safe_op(min, collection, fallback)
+
+def make_main(f):
+    @wraps(f)
+    def wrapper(*args, **kwargs):
+        try:
+            return f(*args, **kwargs)
+        except KeyboardInterrupt:
+            sys.exit(128 + signal.SIGINT)
+    return wrapper

File src/unihistext.py

 import codecs
 from helpers import * 
 
+@make_main
 def main():
 
     from optparse import OptionParser

File src/uninormalize.py

 import codecs
 from helpers import *
 
+@make_main
 def main():
     from optparse import OptionParser
     parser = OptionParser(usage="%prog [options] [[-n] NORM]")