[PATCH 1 of 3] worker: on error, exit similarly to the first failing worker

Kevin Bullock kbullock+mercurial at ringworld.org
Tue Feb 19 18:42:11 UTC 2013


On Feb 19, 2013, at 12:29 PM, Bryan O'Sullivan wrote:

> # HG changeset patch
> # User Bryan O'Sullivan <bryano at fb.com>
> # Date 1361297550 28800
> # Node ID aa2394d75dcc1fb33f3f548013874acdfbaf845f
> # Parent  a326a3b6e3959bba37502a05169cf2797150f4c4
> worker: on error, exit similarly to the first failing worker
> 
> Previously, if a worker failed, we exited with status 1. We now exit
> with the correct exit code (killing ourselves if necessary).
> 
> diff --git a/mercurial/worker.py b/mercurial/worker.py
> --- a/mercurial/worker.py
> +++ b/mercurial/worker.py
> @@ -92,11 +92,15 @@ def _posixworker(ui, func, staticargs, a
>     def cleanup():
>         # python 2.4 is too dumb for try/yield/finally
>         signal.signal(signal.SIGINT, oldhandler)
> -        problems = 0
> +        problem = None
>         for i in xrange(workers):
> -            problems |= os.wait()[1]
> -        if problems:
> -            sys.exit(1)
> +            pid, st = os.wait()
> +            if st and not problem:
> +                problem = _exitstatus(st)

What happens if _exitstatus raises a ValueError here?

pacem in terris / мир / शान्ति / ‎‫سَلاَم‬ / 平和
Kevin R. Bullock




More information about the Mercurial-devel mailing list