Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Unified Diff: runtime/bin/process_macos.cc

Issue 8506009: Avoid creating zombie processes by waiting for the terminated process. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/process_linux.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_macos.cc
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc
index 2b6425b2a4611dac518f8c8b0384e60851ea0af0..df4a7dc5b103959573eef96016568c0ac40ec1fb 100644
--- a/runtime/bin/process_macos.cc
+++ b/runtime/bin/process_macos.cc
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+#include "bin/process.h"
+
#include <errno.h>
#include <fcntl.h>
#include <signal.h>
@@ -11,8 +13,6 @@
#include <unistd.h>
#include "bin/fdutils.h"
-#include "bin/process.h"
-#include "bin/set.h"
class ProcessInfo {
@@ -95,6 +95,11 @@ void ExitHandler(int process_signal, siginfo_t* siginfo, void* tmp) {
}
ProcessInfo* process = LookupProcess(siginfo->si_pid);
if (process != NULL) {
+ int status = 0;
+ int wait_result = waitpid(siginfo->si_pid, &status, WNOHANG);
+ if (wait_result == -1 || wait_result == 0) {
+ perror("ExitHandler waitpid failed");
+ }
intptr_t message[2] = { siginfo->si_pid, siginfo->si_status };
intptr_t result =
FDUtils::WriteToBlocking(process->fd(), &message, sizeof(message));
« no previous file with comments | « runtime/bin/process_linux.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698