From be6c896158171f5c284b8ddb402142e58af38149 Mon Sep 17 00:00:00 2001 From: Tom Ritter Date: Wed, 11 Sep 2019 04:40:11 +0000 Subject: [PATCH] Bug 1575974 - Report any non-zero exit code as a process failure in nsIProcess r=gsvelto EXIT_FAILURE is 'implementation defined' but can be defined to be 1. In our case, pingsender exits with EXIT_FAILURE but nsIProcess wasn't reporting it as failure because it thought failures were always negative. Differential Revision: https://phabricator.services.mozilla.com/D45038 --HG-- extra : moz-landing-system : lando --- toolkit/components/crashes/CrashService.jsm | 2 +- xpcom/tests/unit/test_nsIProcess.js | 4 ++-- xpcom/threads/nsProcessCommon.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toolkit/components/crashes/CrashService.jsm b/toolkit/components/crashes/CrashService.jsm index c47776435626..c433c026e873 100644 --- a/toolkit/components/crashes/CrashService.jsm +++ b/toolkit/components/crashes/CrashService.jsm @@ -65,7 +65,7 @@ function runMinidumpAnalyzer(minidumpPath, allThreads) { break; case "process-failed": gRunningProcesses.delete(process); - reject(); + resolve(); break; default: reject(new Error("Unexpected topic received " + topic)); diff --git a/xpcom/tests/unit/test_nsIProcess.js b/xpcom/tests/unit/test_nsIProcess.js index 6c8c196cfaf2..582d10440c3e 100644 --- a/xpcom/tests/unit/test_nsIProcess.js +++ b/xpcom/tests/unit/test_nsIProcess.js @@ -130,7 +130,7 @@ function test_notify_blocking() { process.runAsync([], 0, { observe(subject, topic, data) { process = subject.QueryInterface(Ci.nsIProcess); - Assert.equal(topic, "process-finished"); + Assert.equal(topic, "process-failed"); Assert.equal(process.exitValue, 42); test_notify_nonblocking(); }, @@ -164,7 +164,7 @@ function test_notify_killed() { process.runAsync([], 0, { observe(subject, topic, data) { process = subject.QueryInterface(Ci.nsIProcess); - Assert.equal(topic, "process-finished"); + Assert.equal(topic, "process-failed"); do_test_finished(); }, }); diff --git a/xpcom/threads/nsProcessCommon.cpp b/xpcom/threads/nsProcessCommon.cpp index b626de205357..2942fbf9e823 100644 --- a/xpcom/threads/nsProcessCommon.cpp +++ b/xpcom/threads/nsProcessCommon.cpp @@ -312,7 +312,7 @@ void nsProcess::ProcessComplete() { } const char* topic; - if (mExitValue < 0) { + if (mExitValue != 0) { topic = "process-failed"; } else { topic = "process-finished";