##// END OF EJS Templates
rename util.set_signal_handler to setsignalhandler
Adrian Buehlmann -
r14237:4d684d82 default
parent child Browse files
Show More
@@ -3756,7 +3756,7 b' def serve(ui, repo, **opts):'
3756
3756
3757 class service(object):
3757 class service(object):
3758 def init(self):
3758 def init(self):
3759 util.set_signal_handler()
3759 util.setsignalhandler()
3760 self.httpd = hgweb.server.create_server(ui, app)
3760 self.httpd = hgweb.server.create_server(ui, app)
3761
3761
3762 if opts['port'] and not ui.verbose:
3762 if opts['port'] and not ui.verbose:
@@ -244,7 +244,7 b' def find_exe(command):'
244 return executable
244 return executable
245 return None
245 return None
246
246
247 def set_signal_handler():
247 def setsignalhandler():
248 pass
248 pass
249
249
250 def statfiles(files):
250 def statfiles(files):
@@ -239,9 +239,9 b' def getuser():'
239 return buf.value
239 return buf.value
240
240
241 _SIGNAL_HANDLER = ctypes.WINFUNCTYPE(_BOOL, _DWORD)
241 _SIGNAL_HANDLER = ctypes.WINFUNCTYPE(_BOOL, _DWORD)
242 _signal_handler = []
242 _signalhandler = []
243
243
244 def set_signal_handler():
244 def setsignalhandler():
245 '''Register a termination handler for console events including
245 '''Register a termination handler for console events including
246 CTRL+C. python signal handlers do not work well with socket
246 CTRL+C. python signal handlers do not work well with socket
247 operations.
247 operations.
@@ -249,10 +249,10 b' def set_signal_handler():'
249 def handler(event):
249 def handler(event):
250 _kernel32.ExitProcess(1)
250 _kernel32.ExitProcess(1)
251
251
252 if _signal_handler:
252 if _signalhandler:
253 return # already registered
253 return # already registered
254 h = _SIGNAL_HANDLER(handler)
254 h = _SIGNAL_HANDLER(handler)
255 _signal_handler.append(h) # needed to prevent garbage collection
255 _signalhandler.append(h) # needed to prevent garbage collection
256 if not _kernel32.SetConsoleCtrlHandler(h, True):
256 if not _kernel32.SetConsoleCtrlHandler(h, True):
257 raise ctypes.WinError()
257 raise ctypes.WinError()
258
258
General Comments 0
You need to be logged in to leave comments. Login now