commit 34d94db25f899f209c95262773f60f77b1fb85e0
parent 8c1c50d22cf687b1c71ba761ca621bbbf964d425
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 11 Jan 2025 09:14:59 +0100
make: Kill child process when a signal is received
Avoid having background processes after make finishes.
Diffstat:
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/cmd/scc-make/posix.c b/src/cmd/scc-make/posix.c
@@ -85,8 +85,11 @@ launch(char *cmd, int ignore)
execve(shell, args, environ);
_exit(127);
default:
- if (waitpid(pid, &st, 0) < 0)
+ if (wait(&st) < 0) {
kill(pid, SIGTERM);
+ wait(&st);
+ }
+
return st;
}
}