| Index: base/process_util_posix.cc
|
| ===================================================================
|
| --- base/process_util_posix.cc (revision 80485)
|
| +++ base/process_util_posix.cc (working copy)
|
| @@ -724,15 +724,14 @@
|
| return false;
|
| if (!waitpid_success)
|
| return false;
|
| + if (!WIFEXITED(status))
|
| + return false;
|
| if (WIFSIGNALED(status)) {
|
| *exit_code = -1;
|
| return true;
|
| }
|
| - if (WIFEXITED(status)) {
|
| - *exit_code = WEXITSTATUS(status);
|
| - return true;
|
| - }
|
| - return false;
|
| + *exit_code = WEXITSTATUS(status);
|
| + return true;
|
| }
|
|
|
| #if defined(OS_MACOSX)
|
| @@ -822,6 +821,19 @@
|
| }
|
| }
|
|
|
| +bool CrashAwareSleep(ProcessHandle handle, int64 wait_milliseconds) {
|
| + bool waitpid_success;
|
| + int status = WaitpidWithTimeout(handle, wait_milliseconds, &waitpid_success);
|
| + if (status != -1) {
|
| + DCHECK(waitpid_success);
|
| + return !(WIFEXITED(status) || WIFSIGNALED(status));
|
| + } else {
|
| + // If waitpid returned with an error, then the process doesn't exist
|
| + // (which most probably means it didn't exist before our call).
|
| + return waitpid_success;
|
| + }
|
| +}
|
| +
|
| int64 TimeValToMicroseconds(const struct timeval& tv) {
|
| static const int kMicrosecondsPerSecond = 1000000;
|
| int64 ret = tv.tv_sec; // Avoid (int * int) integer overflow.
|
|
|