From aa8617d3abf2042b99aaa4c880b395534169814b Mon Sep 17 00:00:00 2001 From: Ben Hutchings Date: Fri, 9 Dec 2005 00:45:24 +0000 Subject: [PATCH] Changed auto_kill_proc_closer to wait for the process to exit after killing it. --- auto_proc.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/auto_proc.cpp b/auto_proc.cpp index 1e7d70c..ad04a12 100644 --- a/auto_proc.cpp +++ b/auto_proc.cpp @@ -15,7 +15,15 @@ void auto_kill_proc_closer::operator()(pid_t pid) const assert(pid >= -1); if (pid > 0 && waitpid(pid, NULL, WNOHANG) == 0) + { kill(pid, SIGTERM); + while (waitpid(pid, NULL, 0) == -1) + if (errno != EINTR) + { + assert(!"invalid pid in auto_kill_proc_closer"); + break; + } + } } void auto_wait_proc_closer::operator()(pid_t pid) const -- 2.39.5