Anonymous committed be94d59

enh: handle Ctrl+C interrupt.

  • Participants
  • Parent commits e515e05

Comments (0)

Files changed (2)

 from optparse import OptionParser
 # initialization
-__version__ = '0.96'
+__version__ = '0.97'
 use_sudo = ('apt-get', 'apt-get remove', 'aptitude', 'apt-key', 'dpkg -i',
             'add-apt-repository ')
     print 'Running:', cmdline
-sys.exit(call(cmdline, shell=True))
+    sys.exit(call(cmdline, shell=True))
+except KeyboardInterrupt:
+    print >> sys.stderr, '\nWarning: Ctrl+C entered, exiting.'
 automatically elevating itself with sudo if need-be.
 It consolidates all commands from ``apt-get`` and ``apt-cache``,
 and the most common from
-``aptitude, dpkg, dpkg-query, add-apt-repository``, and ``apt-key``, etc.
+``aptitude, dpkg, dpkg-query, add-apt-repository``, and ``apt-key``.
 It has a much narrower focus than "kitchen-sink" tools such as ``wajig``.
 Hopefully this micro-project will make your life a tiny bit easier.