mercurial/worker.py
changeset 40989 e10adebf8176
parent 40443 909c31805f54
parent 40988 03f7d0822ec1
child 42455 5ca136bbd3f6
equal deleted inserted replaced
40985:4277e20cfec4 40989:e10adebf8176
   211     def cleanup():
   211     def cleanup():
   212         signal.signal(signal.SIGINT, oldhandler)
   212         signal.signal(signal.SIGINT, oldhandler)
   213         waitforworkers()
   213         waitforworkers()
   214         signal.signal(signal.SIGCHLD, oldchldhandler)
   214         signal.signal(signal.SIGCHLD, oldchldhandler)
   215         selector.close()
   215         selector.close()
   216         status = problem[0]
   216         return problem[0]
   217         if status:
       
   218             if status < 0:
       
   219                 os.kill(os.getpid(), -status)
       
   220             sys.exit(status)
       
   221     try:
   217     try:
   222         openpipes = len(pipes)
   218         openpipes = len(pipes)
   223         while openpipes > 0:
   219         while openpipes > 0:
   224             for key, events in selector.select():
   220             for key, events in selector.select():
   225                 try:
   221                 try:
   234                     raise
   230                     raise
   235     except: # re-raises
   231     except: # re-raises
   236         killworkers()
   232         killworkers()
   237         cleanup()
   233         cleanup()
   238         raise
   234         raise
   239     cleanup()
   235     status = cleanup()
       
   236     if status:
       
   237         if status < 0:
       
   238             os.kill(os.getpid(), -status)
       
   239         sys.exit(status)
   240 
   240 
   241 def _posixexitstatus(code):
   241 def _posixexitstatus(code):
   242     '''convert a posix exit status into the same form returned by
   242     '''convert a posix exit status into the same form returned by
   243     os.spawnv
   243     os.spawnv
   244 
   244