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.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index 8ade06e..895ec3b 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -464,7 +464,8 @@ TerminationStatus GetTerminationStatus(ProcessHandle handle, int* exit_code) {
bool WaitForExitCode(ProcessHandle handle, int* exit_code) {
bool success = WaitForExitCodeWithTimeout(handle, exit_code, INFINITE);
- CloseProcessHandle(handle);
+ if (!success)
+ CloseProcessHandle(handle);
return success;
}
@@ -476,6 +477,10 @@ bool WaitForExitCodeWithTimeout(ProcessHandle handle, int* exit_code,
if (!::GetExitCodeProcess(handle, &temp_code))
return false;
+ // Only close the handle on success, to give the caller a chance to forcefully
+ // terminate the process if he wants to.
+ CloseProcessHandle(handle);
+
*exit_code = temp_code;
return true;
}
@@ -539,6 +544,11 @@ bool WaitForSingleProcess(ProcessHandle handle, int64 wait_milliseconds) {
return retval;
}
+bool CrashAwareSleep(ProcessHandle handle, int64 wait_milliseconds) {
+ bool retval = WaitForSingleObject(handle, wait_milliseconds) == WAIT_TIMEOUT;
+ return retval;
+}
+
bool CleanupProcesses(const std::wstring& executable_name,
int64 wait_milliseconds,
int exit_code,