equal
deleted
inserted
replaced
336 |
336 |
337 class _requesthandler(SocketServer.StreamRequestHandler): |
337 class _requesthandler(SocketServer.StreamRequestHandler): |
338 def handle(self): |
338 def handle(self): |
339 ui = self.server.ui |
339 ui = self.server.ui |
340 repo = self.server.repo |
340 repo = self.server.repo |
341 sv = server(ui, repo, self.rfile, self.wfile) |
341 sv = None |
342 try: |
342 try: |
|
343 sv = server(ui, repo, self.rfile, self.wfile) |
343 try: |
344 try: |
344 sv.serve() |
345 sv.serve() |
345 # handle exceptions that may be raised by command server. most of |
346 # handle exceptions that may be raised by command server. most of |
346 # known exceptions are caught by dispatch. |
347 # known exceptions are caught by dispatch. |
347 except error.Abort as inst: |
348 except error.Abort as inst: |
352 except KeyboardInterrupt: |
353 except KeyboardInterrupt: |
353 pass |
354 pass |
354 except: # re-raises |
355 except: # re-raises |
355 # also write traceback to error channel. otherwise client cannot |
356 # also write traceback to error channel. otherwise client cannot |
356 # see it because it is written to server's stderr by default. |
357 # see it because it is written to server's stderr by default. |
357 traceback.print_exc(file=sv.cerr) |
358 if sv: |
|
359 cerr = sv.cerr |
|
360 else: |
|
361 cerr = channeledoutput(self.wfile, 'e') |
|
362 traceback.print_exc(file=cerr) |
358 raise |
363 raise |
359 |
364 |
360 class unixservice(object): |
365 class unixservice(object): |
361 """ |
366 """ |
362 Listens on unix domain socket and forks server per connection |
367 Listens on unix domain socket and forks server per connection |