summary refs log tree commit diff
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-08-16 00:27:08 -0400
committerJune McEnroe <june@causal.agency>2020-08-16 00:27:08 -0400
commit3fbe9b593321b0bd744b295cc543a0dd87142c86 (patch)
treee028e59d248a247cac520ab4b98785ef4d69cad5
parentSet title after reload (diff)
downloadcatsit-3fbe9b593321b0bd744b295cc543a0dd87142c86.tar.gz
catsit-3fbe9b593321b0bd744b295cc543a0dd87142c86.zip
Use process groups for services
This lets us properly signal services with child processes of their own.
Diffstat (limited to '')
-rw-r--r--service.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/service.c b/service.c
index 63a647c..ec7ac68 100644
--- a/service.c
+++ b/service.c
@@ -174,6 +174,7 @@ void serviceStart(struct Service *service) {
 		return;
 	}
 
+	setpgid(0, 0);
 	dup2(service->outPipe[1], STDOUT_FILENO);
 	dup2(service->errPipe[1], STDERR_FILENO);
 
@@ -207,10 +208,10 @@ void serviceStart(struct Service *service) {
 
 void serviceSignal(struct Service *service, int signal) {
 	if (service->state != Start) return;
-	int error = kill(service->pid, signal);
+	int error = killpg(service->pid, signal);
 	if (error) {
 		syslog(
-			LOG_WARNING, "kill(%s[%d], %s): %m",
+			LOG_WARNING, "killpg(%s[%d], %s): %m",
 			service->name, service->pid, sys_signame[signal]
 		);
 	}
/td> 2019-02-18Match statics and typedefs as TagJune McEnroe 2019-02-18Clean up htmlHeaderJune McEnroe 2019-02-18Remove hi line numberingJune McEnroe Tags are much better for referring to specific parts of a file and line numbering is better done by a post-processing tool such as cat -n or producing a two-column HTML <table>. 2019-02-18Add Tag class to hiJune McEnroe 2019-02-17Generate HTML with hi -n -f html -o anchorJune McEnroe Running hi twice to insert stuff between the head and the content is a bit of a hack but oh well. 2019-02-17Add hi -f html -o anchor for line number linksJune McEnroe 2019-02-17Simplify temp trap in upJune McEnroe 2019-02-17Add line numbers to hiJune McEnroe Renames previous -n option to -m to stay consistent with cat -n. Prefixing lines with line numbers affects where the first tab indent ends up relative to the text above it. Not sure if it's worth fixing somehow. 2019-02-17Always split spans after newlinesJune McEnroe Simplifies ANSI and IRC output code, and prepares for line numbered output. 2019-02-15Color format specifiers light cyan in vimJune McEnroe 2019-02-15Highlight Interp as yellowJune McEnroe 2019-02-15Highlight strings in sh command substitutionsJune McEnroe 2019-02-15Add nmap gpJune McEnroe 2019-02-14Avoid newline when copying URL to pasteboardJune McEnroe 2019-02-13Add forgotten "sixth" book of H2G2June McEnroe