From b113edeab780216b0590045b932be685d1399e9b Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 25 Jun 2004 15:36:09 +0000 Subject: * A flag `--keep-going / -k' to keep building goals if one fails, as much as possible. (This is similar to GNU Make's `-k' flag.) * Refactoring to implement this: previously we just bombed out when a build failed, but now we have to clean up. In particular this means that goals must be freed quickly --- they shouldn't hang around until the worker exits. So the worker now maintains weak pointers in order not to prevent garbage collection. * Documented the `-k' and `-j' flags. --- src/libutil/util.cc | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'src/libutil/util.cc') diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 5511b27c9726..43ec2b9f3be8 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -492,20 +492,19 @@ void Pid::kill() { if (pid == -1) return; - printMsg(lvlError, format("killing child process %1%") % pid); + printMsg(lvlError, format("killing process %1%") % pid); /* Send a KILL signal to the child. If it has its own process group, send the signal to every process in the child process group (which hopefully includes *all* its children). */ if (::kill(separatePG ? -pid : pid, SIGKILL) != 0) - printMsg(lvlError, format("killing process %1%") % pid); - else { - /* Wait until the child dies, disregarding the exit status. */ - int status; - while (waitpid(pid, &status, 0) == -1) - if (errno != EINTR) printMsg(lvlError, - format("waiting for process %1%") % pid); - } + printMsg(lvlError, (SysError(format("killing process %1%") % pid).msg())); + + /* Wait until the child dies, disregarding the exit status. */ + int status; + while (waitpid(pid, &status, 0) == -1) + if (errno != EINTR) printMsg(lvlError, + (SysError(format("waiting for process %1%") % pid).msg())); pid = -1; } -- cgit 1.4.1