[PATCH 1 of 2 V2] chg: forward SIGINT, SIGHUP to process group

Yuya Nishihara yuya at tcha.org
Tue Jul 19 08:28:50 EDT 2016


On Mon, 18 Jul 2016 16:04:47 +0100, Jun Wu wrote:
> # HG changeset patch
> # User Jun Wu <quark at fb.com>
> # Date 1468792547 -3600
> #      Sun Jul 17 22:55:47 2016 +0100
> # Node ID c782f543300c7cf3b52d64dfbf4f5b9e3878e1c7
> # Parent  953839de96ab574caa40557c542c262286c6287c
> # Available At https://bitbucket.org/quark-zju/hg-draft
> #              hg pull https://bitbucket.org/quark-zju/hg-draft -r c782f543300c
> chg: forward SIGINT, SIGHUP to process group

LGTM, pushed them to stable branch per mpm's approval. Thanks.

> -static void setupsignalhandler(pid_t pid)
> +static void setupsignalhandler(const hgclient_t *hgc)
>  {
> +	pid_t pid = hgc_peerpid(hgc);
>  	if (pid <= 0)
>  		return;
>  	peerpid = pid;
>  
> +	pid_t pgid = hgc_peerpgid(hgc);
> +	peerpgid = (pgid <= 1 ? 0 : pgid);
> +
>  	struct sigaction sa;
>  	memset(&sa, 0, sizeof(sa));
> -	sa.sa_handler = forwardsignal;
> +	sa.sa_handler = forwardsignaltogroup;

This could be

  (pgid > 1) ? forwardsignaltogroup : forwardsignal;


More information about the Mercurial-devel mailing list