serve: rename --daemon-pipefds to --daemon-postexec (BC)
Initially we use --daemon-pipefds to pass file descriptors for synchronization.
Later, in order to support Windows, --daemon-pipefds is changed to accept a
file path to unlink instead. The name is outdated since then.
chg client is designed to use flock, which will be held before starting a
server and until the client actually connects to the server it started. The
unlink synchronization approach is not so helpful in this case.
To address the issues, this patch renames pipefds to postexec and the following
patch will allow the value of --daemon-postexec to be things like
'unlink:/path/to/file' or 'none'.
--- a/contrib/chg/chg.c Mon Feb 22 23:18:19 2016 -0800
+++ b/contrib/chg/chg.c Mon Feb 22 16:59:08 2016 +0000
@@ -189,7 +189,7 @@
"--cwd", "/",
"--cmdserver", "chgunix",
"--address", opts->sockname,
- "--daemon-pipefds", opts->lockfile,
+ "--daemon-postexec", opts->lockfile,
"--pid-file", opts->pidfile,
"--config", "extensions.chgserver=",
/* wrap root ui so that it can be disabled/enabled by config */
--- a/mercurial/cmdutil.py Mon Feb 22 23:18:19 2016 -0800
+++ b/mercurial/cmdutil.py Mon Feb 22 16:59:08 2016 +0000
@@ -758,14 +758,14 @@
fp.write(str(pid) + '\n')
fp.close()
- if opts['daemon'] and not opts['daemon_pipefds']:
+ if opts['daemon'] and not opts['daemon_postexec']:
# Signal child process startup with file removal
lockfd, lockpath = tempfile.mkstemp(prefix='hg-service-')
os.close(lockfd)
try:
if not runargs:
runargs = util.hgcmd() + sys.argv[1:]
- runargs.append('--daemon-pipefds=%s' % lockpath)
+ runargs.append('--daemon-postexec=%s' % lockpath)
# Don't pass --cwd to the child process, because we've already
# changed directory.
for i in xrange(1, len(runargs)):
@@ -798,8 +798,8 @@
if not opts['daemon']:
writepid(util.getpid())
- if opts['daemon_pipefds']:
- lockpath = opts['daemon_pipefds']
+ if opts['daemon_postexec']:
+ lockpath = opts['daemon_postexec']
try:
os.setsid()
except AttributeError:
--- a/mercurial/commands.py Mon Feb 22 23:18:19 2016 -0800
+++ b/mercurial/commands.py Mon Feb 22 16:59:08 2016 +0000
@@ -6208,7 +6208,7 @@
[('A', 'accesslog', '', _('name of access log file to write to'),
_('FILE')),
('d', 'daemon', None, _('run server in background')),
- ('', 'daemon-pipefds', '', _('used internally by daemon mode'), _('FILE')),
+ ('', 'daemon-postexec', '', _('used internally by daemon mode')),
('E', 'errorlog', '', _('name of error log file to write to'), _('FILE')),
# use string type, then we can check if something was passed
('p', 'port', '', _('port to listen on (default: 8000)'), _('PORT')),
--- a/tests/dumbhttp.py Mon Feb 22 23:18:19 2016 -0800
+++ b/tests/dumbhttp.py Mon Feb 22 16:59:08 2016 +0000
@@ -38,7 +38,7 @@
parser.add_option('-f', '--foreground', dest='foreground',
action='store_true',
help='do not start the HTTP server in the background')
- parser.add_option('--daemon-pipefds')
+ parser.add_option('--daemon-postexec')
(options, args) = parser.parse_args()
@@ -49,7 +49,7 @@
opts = {'pid_file': options.pid,
'daemon': not options.foreground,
- 'daemon_pipefds': options.daemon_pipefds}
+ 'daemon_postexec': options.daemon_postexec}
service = simplehttpservice(options.host, options.port)
cmdutil.service(opts, initfn=service.init, runfn=service.run,
runargs=[sys.executable, __file__] + sys.argv[1:])
--- a/tests/test-completion.t Mon Feb 22 23:18:19 2016 -0800
+++ b/tests/test-completion.t Mon Feb 22 16:59:08 2016 +0000
@@ -158,7 +158,7 @@
--config
--cwd
--daemon
- --daemon-pipefds
+ --daemon-postexec
--debug
--debugger
--encoding
@@ -218,7 +218,7 @@
pull: update, force, rev, bookmark, branch, ssh, remotecmd, insecure
push: force, rev, bookmark, branch, new-branch, ssh, remotecmd, insecure
remove: after, force, subrepos, include, exclude
- serve: accesslog, daemon, daemon-pipefds, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate
+ serve: accesslog, daemon, daemon-postexec, errorlog, port, address, prefix, name, web-conf, webdir-conf, pid-file, stdio, cmdserver, templates, style, ipv6, certificate
status: all, modified, added, removed, deleted, clean, unknown, ignored, no-status, copies, print0, rev, change, include, exclude, subrepos, template
summary: remote
update: clean, check, date, rev, tool