From 42b9381c9d7f7f7006c288b9763a574105e2b35f Mon Sep 17 00:00:00 2001 From: Josh Aas Date: Mon, 25 Oct 2010 16:57:18 -0400 Subject: [PATCH] Bug 599478: Fix incorrect exit code for unhandled signal termination in nsIProcess on Mac OS X. r=bsmedberg a=blocking2.0betaN+ --- xpcom/tests/unit/test_nsIProcess.js | 5 ----- xpcom/threads/nsProcessCommon.cpp | 10 ++++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/xpcom/tests/unit/test_nsIProcess.js b/xpcom/tests/unit/test_nsIProcess.js index 165d1cb02984..c39fe694c2c7 100644 --- a/xpcom/tests/unit/test_nsIProcess.js +++ b/xpcom/tests/unit/test_nsIProcess.js @@ -251,11 +251,6 @@ function test_kill_2() } function run_test() { - var isOSX = ("nsILocalFileMac" in Components.interfaces); - if (isOSX) { - dump("INFO | test_nsIProcess.js | Skipping test on mac, bug 599478") - return; - } set_environment(); test_kill(); test_quick(); diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index 143f7eb5d140..a0ffad2be678 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -287,8 +287,14 @@ void PR_CALLBACK nsProcess::Monitor(void *arg) #ifdef XP_MACOSX int exitCode = -1; int status = 0; - if (waitpid(process->mPid, &status, 0) == process->mPid && WIFEXITED(status)) - exitCode = WEXITSTATUS(status); + if (waitpid(process->mPid, &status, 0) == process->mPid) { + if (WIFEXITED(status)) { + exitCode = WEXITSTATUS(status); + } + else if(WIFSIGNALED(status)) { + exitCode = 256; // match NSPR's signal exit status + } + } #else PRInt32 exitCode = -1; if (PR_WaitProcess(process->mProcess, &exitCode) != PR_SUCCESS)