summaryrefslogtreecommitdiffstats
path: root/base/process_util_win.cc
diff options
context:
space:
mode:
Diffstat (limited to 'base/process_util_win.cc')
-rw-r--r--base/process_util_win.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index 1203629..a69f5d5 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -10,6 +10,7 @@
#include "base/histogram.h"
#include "base/logging.h"
+#include "base/scoped_handle_win.h"
#include "base/scoped_ptr.h"
namespace {
@@ -226,6 +227,19 @@ bool DidProcessCrash(ProcessHandle handle) {
return true;
}
+bool WaitForExitCode(ProcessHandle handle, int* exit_code) {
+ ScopedHandle closer(handle); // Ensure that we always close the handle.
+ if (::WaitForSingleObject(handle, INFINITE) != WAIT_OBJECT_0) {
+ NOTREACHED();
+ return false;
+ }
+ DWORD temp_code; // Don't clobber out-parameters in case of failure.
+ if (!::GetExitCodeProcess(handle, &temp_code))
+ return false;
+ *exit_code = temp_code;
+ return true;
+}
+
NamedProcessIterator::NamedProcessIterator(const std::wstring& executable_name,
const ProcessFilter* filter) :
started_iteration_(false),