chg: decouple hgclient from setupsignalhandler
procutil should not depend on hgclient. This patch makes the signal handling
part independent from hgclient.
--- 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;