[PATCH 1 of 2 STABLE] worker: be silent if killed by the main process

Jun Wu quark at fb.com
Sun Apr 23 08:08:48 EDT 2017

Excerpts from Yuya Nishihara's message of 2017-04-23 19:56:13 +0900:
> These look good to me, thanks. I think the first patch is simple enough to
> include in stable if that helps solving the CI issue.
> A few nits:
>  - pid could be initialized to a null value instead of comparing to parentpid
>    pid = -1
>    try:
>        pid = os.fork()
>        ...
>    finally:
>        if pid == 0:

This won't pass the test. If fork() is completed, but "pid = os.fork()"
assignment is not, pid still have the old value and will have trouble. I
think it's safer to not assume whether Python implementation will make it
atomic or not.

>            os._exit()
>  - BaseException can be used to catch any exception object

According to http://stackoverflow.com/a/7161517 , it will miss Python2
old-style classes.

More information about the Mercurial-devel mailing list