changeset 30690:e9ec42634ec8

chg: decouple hgclient from setupsignalhandler procutil should not depend on hgclient. This patch makes the signal handling part independent from hgclient.
author Jun Wu <quark@fb.com>
date Mon, 02 Jan 2017 14:04:35 +0000
parents 9fa7255d4abd
children 7adb60660496
files contrib/chg/chg.c contrib/chg/procutil.c
diffstat 2 files changed, 2 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/chg/chg.c	Mon Jan 02 14:02:47 2017 +0000
+++ b/contrib/chg/chg.c	Mon Jan 02 14:04:35 2017 +0000
@@ -429,7 +429,7 @@
 				 gethgcmd());
 	}
 
-	setupsignalhandler(hgc);
+	setupsignalhandler(hgc_peerpid(hgc), hgc_peerpgid(hgc));
 	pagerpid = setuppager(hgc, argv + 1, argc - 1);
 	int exitcode = hgc_runcommand(hgc, argv + 1, argc - 1);
 	restoresignalhandler();
--- a/contrib/chg/procutil.c	Mon Jan 02 14:02:47 2017 +0000
+++ b/contrib/chg/procutil.c	Mon Jan 02 14:04:35 2017 +0000
@@ -71,14 +71,11 @@
 		kill(peerpid, SIGPIPE);
 }
 
-static void setupsignalhandler(const hgclient_t *hgc)
+static void setupsignalhandler(pid_t pid, pid_t pgid)
 {
-	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;