pwtest: ensure all spawned daemons are terminated

Set process group, and send signal to them all.
This commit is contained in:
Pauli Virtanen 2022-03-05 11:33:19 +02:00 committed by Wim Taymans
parent 24fd273820
commit df4f844daa

View file

@ -653,6 +653,8 @@ static pid_t start_pwdaemon(struct pwtest_test *t, int stderr_fd, int log_fd)
pid = fork();
if (pid == 0) {
/* child */
setpgid(0, 0);
setenv("PIPEWIRE_CORE", pw_remote, 1);
dup2(stderr_fd, STDERR_FILENO);
@ -983,7 +985,7 @@ error:
if (pw_daemon > 0) {
int status;
kill(pw_daemon, SIGTERM);
kill(-pw_daemon, SIGTERM);
r = waitpid(pw_daemon, &status, 0);
if (r > 0) {
/* write_fds are closed in the parent process, so we append directly */