equal
deleted
inserted
replaced
316 |
316 |
317 def run(self): |
317 def run(self): |
318 ui = self.ui |
318 ui = self.ui |
319 # redirect stdio to null device so that broken extensions or in-process |
319 # redirect stdio to null device so that broken extensions or in-process |
320 # hooks will never cause corruption of channel protocol. |
320 # hooks will never cause corruption of channel protocol. |
321 fin, fout = procutil.protectstdio(ui.fin, ui.fout) |
321 with procutil.protectedstdio(ui.fin, ui.fout) as (fin, fout): |
322 try: |
322 try: |
323 sv = server(ui, self.repo, fin, fout) |
323 sv = server(ui, self.repo, fin, fout) |
324 return sv.serve() |
324 return sv.serve() |
325 finally: |
325 finally: |
326 sv.cleanup() |
326 sv.cleanup() |
327 procutil.restorestdio(ui.fin, ui.fout, fin, fout) |
|
328 |
327 |
329 def _initworkerprocess(): |
328 def _initworkerprocess(): |
330 # use a different process group from the master process, in order to: |
329 # use a different process group from the master process, in order to: |
331 # 1. make the current process group no longer "orphaned" (because the |
330 # 1. make the current process group no longer "orphaned" (because the |
332 # parent of this process is in a different process group while |
331 # parent of this process is in a different process group while |