Bug 599478: Fix incorrect exit code for unhandled signal termination in nsIProcess on Mac OS X. r=bsmedberg a=blocking2.0betaN+

This commit is contained in:
Josh Aas 2010-10-25 16:57:18 -04:00
parent f13f942751
commit 9298c75766
2 changed files with 8 additions and 7 deletions

View File

@ -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();

View File

@ -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)