Show More
@@ -353,6 +353,7 b' class chgcmdserver(commandserver.server)' | |||||
353 | self.capabilities['validate'] = chgcmdserver.validate |
|
353 | self.capabilities['validate'] = chgcmdserver.validate | |
354 |
|
354 | |||
355 | def cleanup(self): |
|
355 | def cleanup(self): | |
|
356 | super(chgcmdserver, self).cleanup() | |||
356 | # dispatch._runcatch() does not flush outputs if exception is not |
|
357 | # dispatch._runcatch() does not flush outputs if exception is not | |
357 | # handled by dispatch._dispatch() |
|
358 | # handled by dispatch._dispatch() | |
358 | self.ui.flush() |
|
359 | self.ui.flush() |
@@ -179,6 +179,10 b' class server(object):' | |||||
179 |
|
179 | |||
180 | self.client = fin |
|
180 | self.client = fin | |
181 |
|
181 | |||
|
182 | def cleanup(self): | |||
|
183 | """release and restore resources taken during server session""" | |||
|
184 | pass | |||
|
185 | ||||
182 | def _read(self, size): |
|
186 | def _read(self, size): | |
183 | if not size: |
|
187 | if not size: | |
184 | return '' |
|
188 | return '' | |
@@ -329,6 +333,7 b' class pipeservice(object):' | |||||
329 | sv = server(ui, self.repo, fin, fout) |
|
333 | sv = server(ui, self.repo, fin, fout) | |
330 | return sv.serve() |
|
334 | return sv.serve() | |
331 | finally: |
|
335 | finally: | |
|
336 | sv.cleanup() | |||
332 | _restoreio(ui, fin, fout) |
|
337 | _restoreio(ui, fin, fout) | |
333 |
|
338 | |||
334 | class _requesthandler(socketserver.StreamRequestHandler): |
|
339 | class _requesthandler(socketserver.StreamRequestHandler): | |
@@ -348,6 +353,8 b' class _requesthandler(socketserver.Strea' | |||||
348 | raise |
|
353 | raise | |
349 | except KeyboardInterrupt: |
|
354 | except KeyboardInterrupt: | |
350 | pass |
|
355 | pass | |
|
356 | finally: | |||
|
357 | sv.cleanup() | |||
351 | except: # re-raises |
|
358 | except: # re-raises | |
352 | # also write traceback to error channel. otherwise client cannot |
|
359 | # also write traceback to error channel. otherwise client cannot | |
353 | # see it because it is written to server's stderr by default. |
|
360 | # see it because it is written to server's stderr by default. |
General Comments 0
You need to be logged in to leave comments.
Login now