[PATCH 2 of 2] chg: forward user-defined signals

Jun Wu quark at fb.com
Wed Mar 8 16:47:49 EST 2017


# HG changeset patch
# User Jun Wu <quark at fb.com>
# Date 1489009586 28800
#      Wed Mar 08 13:46:26 2017 -0800
# Node ID 574c38eff4205523a7b30e4b9d5b39e9c9d93a42
# Parent  26c57e0bc4b0d3c78fc0ddf9701d418d70fa0013
# Available At https://bitbucket.org/quark-zju/hg-draft
#              hg pull https://bitbucket.org/quark-zju/hg-draft -r 574c38eff420
chg: forward user-defined signals

SIGUSR1 and SIGUSR2 are reserved for user-defined behaviors. They may be
redefined by an hg extension [1], but cannot be easily redefined for chg.
Since the default behavior (kill) is not that useful for chg, let's forward
them to hg, hoping it got redefined there and could be more useful.

[1] https://bitbucket.org/facebook/hg-experimental/commits/e7c883a465

diff --git a/contrib/chg/procutil.c b/contrib/chg/procutil.c
--- a/contrib/chg/procutil.c
+++ b/contrib/chg/procutil.c
@@ -116,4 +116,9 @@ void setupsignalhandler(pid_t pid, pid_t
 	if (sigaction(SIGWINCH, &sa, NULL) < 0)
 		goto error;
+	/* forward user-defined signals */
+	if (sigaction(SIGUSR1, &sa, NULL) < 0)
+		goto error;
+	if (sigaction(SIGUSR2, &sa, NULL) < 0)
+		goto error;
 	/* propagate job control requests to worker */
 	sa.sa_handler = forwardsignal;


More information about the Mercurial-devel mailing list