[PATCH 4 of 4] serve: ignore os.setsid EPERM error

Yuya Nishihara yuya at tcha.org
Fri Mar 11 03:14:19 EST 2016


On Wed, 9 Mar 2016 02:23:26 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1457487748 0
> #      Wed Mar 09 01:42:28 2016 +0000
> # Node ID d2f89bd9d8cf5b0451d282ad0517b689234a1734
> # Parent  e18454eee99d96f1dc16833c98951cadc50a3b1c
> serve: ignore os.setsid EPERM error
> 
> Before this patch, if a user tries to run "hg serve" manually with the flag
> "--daemon-postexec", they will probably get an error like: "OSError: [Errno
> 1] Operation not permitted". This patch ignores the error.

Does it happen in real use case? It would be harmless to ignore EPERM, but
seems not correct as --daemon-postexec should be called after fork().

> --- a/mercurial/cmdutil.py
> +++ b/mercurial/cmdutil.py
> @@ -829,7 +829,7 @@
>      if opts['daemon_postexec']:
>          try:
>              os.setsid()
> -        except AttributeError:
> +        except OSError:

AttributeError is raised on Windows.


More information about the Mercurial-devel mailing list