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

Jun Wu quark at fb.com
Tue Mar 8 21:23:26 EST 2016


# 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.

diff --git a/mercurial/cmdutil.py b/mercurial/cmdutil.py
--- a/mercurial/cmdutil.py
+++ b/mercurial/cmdutil.py
@@ -829,7 +829,7 @@
     if opts['daemon_postexec']:
         try:
             os.setsid()
-        except AttributeError:
+        except OSError:
             pass
         for inst in opts['daemon_postexec']:
             if inst.startswith('unlink:'):


More information about the Mercurial-devel mailing list