Mercurial > public > mercurial-scm > hg
comparison mercurial/dispatch.py @ 7644:182b7114d35a
error: move SignalInterrupt
now derived from KeyboardInterrupt to simplify catches
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Mon, 12 Jan 2009 11:48:05 -0600 |
parents | 9a1ea6587557 |
children | 020a896a5292 |
comparison
equal
deleted
inserted
replaced
7643:9a1ea6587557 | 7644:182b7114d35a |
---|---|
24 return -1 | 24 return -1 |
25 return _runcatch(u, args) | 25 return _runcatch(u, args) |
26 | 26 |
27 def _runcatch(ui, args): | 27 def _runcatch(ui, args): |
28 def catchterm(*args): | 28 def catchterm(*args): |
29 raise util.SignalInterrupt | 29 raise error.SignalInterrupt |
30 | 30 |
31 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': | 31 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': |
32 num = getattr(signal, name, None) | 32 num = getattr(signal, name, None) |
33 if num: signal.signal(num, catchterm) | 33 if num: signal.signal(num, catchterm) |
34 | 34 |
72 except error.LockUnavailable, inst: | 72 except error.LockUnavailable, inst: |
73 ui.warn(_("abort: could not lock %s: %s\n") % | 73 ui.warn(_("abort: could not lock %s: %s\n") % |
74 (inst.desc or inst.filename, inst.strerror)) | 74 (inst.desc or inst.filename, inst.strerror)) |
75 except error.RevlogError, inst: | 75 except error.RevlogError, inst: |
76 ui.warn(_("abort: %s!\n") % inst) | 76 ui.warn(_("abort: %s!\n") % inst) |
77 except util.SignalInterrupt: | 77 except error.SignalInterrupt: |
78 ui.warn(_("killed!\n")) | 78 ui.warn(_("killed!\n")) |
79 except KeyboardInterrupt: | 79 except KeyboardInterrupt: |
80 try: | 80 try: |
81 ui.warn(_("interrupted!\n")) | 81 ui.warn(_("interrupted!\n")) |
82 except IOError, inst: | 82 except IOError, inst: |