[PATCH 2 of 2] chg: do not write pidfile

Yuya Nishihara yuya at tcha.org
Fri Mar 11 03:10:17 EST 2016


On Thu, 10 Mar 2016 00:32:31 +0000, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1457569195 0
> #      Thu Mar 10 00:19:55 2016 +0000
> # Node ID 1d7ddf23a970310f5288a275080061ebc7ce5762
> # Parent  a0a69881240c389b0c5e84451474cde66025f6d8
> chg: do not write pidfile
> 
> Current pidfile logic will only keep the pid of the newest server, which is
> not very useful if we want to kill all servers, and will become outdated if
> the server auto exits after being idle for too long.
> 
> Besides, the server-side pidfile writing logic runs before chgserver gets
> confighash so it's not trivial to append confighash to pidfile basename like
> we did for socket file.
> 
> This patch removes --pidfile from the command starting chgserver and switches
> to an alternative way (unlink socket file) to stop the server.

I like plain old pidfile, but new approach works better and simpler. Pushed to
the clowncopter, thanks.

> +	char *resolvedpath = realpath(opts->sockname, NULL);

Added short comment why we do realpath().

> +	if (resolvedpath) {
> +		unlink(resolvedpath);
> +		free(resolvedpath);

And updated run-tests.py to unlink(sock) in place of killdaemons().


More information about the Mercurial-devel mailing list