mercurial/commandserver.py
changeset 49304 48f1b314056b
parent 49303 dfdf85f37215
child 50557 6e749d4abf05
equal deleted inserted replaced
49303:dfdf85f37215 49304:48f1b314056b
     4 #
     4 #
     5 # This software may be used and distributed according to the terms of the
     5 # This software may be used and distributed according to the terms of the
     6 # GNU General Public License version 2 or any later version.
     6 # GNU General Public License version 2 or any later version.
     7 
     7 
     8 
     8 
     9 import errno
       
    10 import gc
     9 import gc
    11 import os
    10 import os
    12 import random
    11 import random
    13 import selectors
    12 import selectors
    14 import signal
    13 import signal
   492             sv.serve()
   491             sv.serve()
   493         # handle exceptions that may be raised by command server. most of
   492         # handle exceptions that may be raised by command server. most of
   494         # known exceptions are caught by dispatch.
   493         # known exceptions are caught by dispatch.
   495         except error.Abort as inst:
   494         except error.Abort as inst:
   496             ui.error(_(b'abort: %s\n') % inst.message)
   495             ui.error(_(b'abort: %s\n') % inst.message)
   497         except IOError as inst:
   496         except BrokenPipeError:
   498             if inst.errno != errno.EPIPE:
   497             pass
   499                 raise
       
   500         except KeyboardInterrupt:
   498         except KeyboardInterrupt:
   501             pass
   499             pass
   502         finally:
   500         finally:
   503             sv.cleanup()
   501             sv.cleanup()
   504     except:  # re-raises
   502     except:  # re-raises
   512         raise
   510         raise
   513     finally:
   511     finally:
   514         fin.close()
   512         fin.close()
   515         try:
   513         try:
   516             fout.close()  # implicit flush() may cause another EPIPE
   514             fout.close()  # implicit flush() may cause another EPIPE
   517         except IOError as inst:
   515         except BrokenPipeError:
   518             if inst.errno != errno.EPIPE:
   516             pass
   519                 raise
       
   520 
   517 
   521 
   518 
   522 class unixservicehandler:
   519 class unixservicehandler:
   523     """Set of pluggable operations for unix-mode services
   520     """Set of pluggable operations for unix-mode services
   524 
   521