##// END OF EJS Templates
Handle CTRL+C in serve under Windows.
Marcos Chaves -
r4672:272c0a09 default
parent child Browse files
Show More
@@ -2401,6 +2401,7 b' def serve(ui, repo, **opts):'
2401
2401
2402 class service:
2402 class service:
2403 def init(self):
2403 def init(self):
2404 util.set_signal_handler()
2404 try:
2405 try:
2405 self.httpd = hgweb.server.create_server(parentui, repo)
2406 self.httpd = hgweb.server.create_server(parentui, repo)
2406 except socket.error, inst:
2407 except socket.error, inst:
@@ -1100,6 +1100,9 b' else:'
1100 return p_name
1100 return p_name
1101 return default
1101 return default
1102
1102
1103 def set_signal_handler():
1104 pass
1105
1103 def find_exe(name, default=None):
1106 def find_exe(name, default=None):
1104 '''find path of an executable.
1107 '''find path of an executable.
1105 if name contains a path component, return it as is. otherwise,
1108 if name contains a path component, return it as is. otherwise,
@@ -299,3 +299,12 b' class posixfile_nt(object):'
299 raise WinIOError(err)
299 raise WinIOError(err)
300
300
301 getuser_fallback = win32api.GetUserName
301 getuser_fallback = win32api.GetUserName
302
303 def set_signal_handler():
304 """Register a termination handler for console events including
305 CTRL+C. python signal handlers do not work well with socket
306 operations.
307 """
308 def handler(event):
309 win32process.ExitProcess(1)
310 win32api.SetConsoleCtrlHandler(handler)
General Comments 0
You need to be logged in to leave comments. Login now