From: Richard Purdie <richard.pur...@linuxfoundation.org>

Rather than just killing the process we've swawned, set the process group
for spawned children and then kill the group of processes.

Signed-off-by: Richard Purdie <richard.pur...@linuxfoundation.org>
Upstream-Status: Pending [code being tested]
---
 utils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/utils.c b/utils.c
index 9fab6f2..86dcdad 100644
--- a/utils.c
+++ b/utils.c
@@ -330,7 +330,7 @@ wait_child(const char *ptest_dir, const char *run_ptest, 
pid_t pid,
                        clock_gettime(clock, &time);
                        if ((time.tv_sec - sentinel.tv_sec) > timeout) {
                                *timeouted = 1;
-                               kill(pid, SIGKILL);
+                               kill(-pid, SIGKILL);
                                waitflags = 0;
                        }
                }
@@ -392,6 +392,7 @@ run_ptests(struct ptest_list *head, const struct 
ptest_options opts,
                                rc = -1;
                                break;
                        } else if (child == 0) {
+                               setsid();
                                run_child(p->run_ptest, pipefd_stdout[1], 
pipefd_stderr[1]);
                        } else {
                                int status;
-- 
2.17.0

-- 
_______________________________________________
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto

Reply via email to