Mercurial > public > mercurial-scm > hg
comparison mercurial/cmdutil.py @ 28451:c90cfe76e024
serve: accept multiple values for --daemon-postexec
The next patch will add another postexec command: chdir, which can be used
together with unlink. This patch changes the option type of --daemon-postexec
from string to list to accept multiple commands. The error message of invalid
--daemon-postexec value is also changed to include the actual invalid value.
author | Jun Wu <quark@fb.com> |
---|---|
date | Wed, 09 Mar 2016 02:07:40 +0000 |
parents | 3072ce740945 |
children | 0bb01c8754bf |
comparison
equal
deleted
inserted
replaced
28450:155e3308289c | 28451:c90cfe76e024 |
---|---|
825 | 825 |
826 if not opts['daemon']: | 826 if not opts['daemon']: |
827 writepid(util.getpid()) | 827 writepid(util.getpid()) |
828 | 828 |
829 if opts['daemon_postexec']: | 829 if opts['daemon_postexec']: |
830 inst = opts['daemon_postexec'] | |
831 try: | 830 try: |
832 os.setsid() | 831 os.setsid() |
833 except AttributeError: | 832 except AttributeError: |
834 pass | 833 pass |
835 if inst.startswith('unlink:'): | 834 for inst in opts['daemon_postexec']: |
836 lockpath = inst[7:] | 835 if inst.startswith('unlink:'): |
837 os.unlink(lockpath) | 836 lockpath = inst[7:] |
838 elif inst != 'none': | 837 os.unlink(lockpath) |
839 raise error.Abort(_('invalid value for --daemon-postexec')) | 838 elif inst != 'none': |
839 raise error.Abort(_('invalid value for --daemon-postexec: %s') | |
840 % inst) | |
840 util.hidewindow() | 841 util.hidewindow() |
841 sys.stdout.flush() | 842 sys.stdout.flush() |
842 sys.stderr.flush() | 843 sys.stderr.flush() |
843 | 844 |
844 nullfd = os.open(os.devnull, os.O_RDWR) | 845 nullfd = os.open(os.devnull, os.O_RDWR) |