Show More
@@ -1,4 +1,4 b'' | |||
|
1 | import os, re, traceback, sys | |
|
1 | import os, re, traceback, sys, signal | |
|
2 | 2 | from mercurial import fancyopts, ui, hg |
|
3 | 3 | |
|
4 | 4 | class UnknownCommand(Exception): pass |
@@ -159,6 +159,11 b' def find(cmd):' | |||
|
159 | 159 | |
|
160 | 160 | raise UnknownCommand(cmd) |
|
161 | 161 | |
|
162 | class SignalInterrupt(Exception): pass | |
|
163 | ||
|
164 | def catchterm(*args): | |
|
165 | raise SignalInterrupt | |
|
166 | ||
|
162 | 167 | def dispatch(args): |
|
163 | 168 | options = {} |
|
164 | 169 | opts = [('v', 'verbose', None, 'verbose'), |
@@ -181,6 +186,8 b' def dispatch(args):' | |||
|
181 | 186 | # deal with unfound commands later |
|
182 | 187 | i = find(cmd) |
|
183 | 188 | |
|
189 | signal.signal(signal.SIGTERM, catchterm) | |
|
190 | ||
|
184 | 191 | cmdoptions = {} |
|
185 | 192 | args = fancyopts.fancyopts(args, i[1], cmdoptions, i[2]) |
|
186 | 193 | |
@@ -192,6 +199,8 b' def dispatch(args):' | |||
|
192 | 199 | |
|
193 | 200 | try: |
|
194 | 201 | d() |
|
202 | except SignalInterrupt: | |
|
203 | u.warn("killed!\n") | |
|
195 | 204 | except KeyboardInterrupt: |
|
196 | 205 | u.warn("interrupted!\n") |
|
197 | 206 | except TypeError, inst: |
General Comments 0
You need to be logged in to leave comments.
Login now