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
This commit is contained in:
Tom Ritter 2019-09-11 04:40:11 +00:00
parent 6ba489874b
commit be6c896158
3 changed files with 4 additions and 4 deletions

View File

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

View File

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

View File

@ -312,7 +312,7 @@ void nsProcess::ProcessComplete() {
}
const char* topic;
if (mExitValue < 0) {
if (mExitValue != 0) {
topic = "process-failed";
} else {
topic = "process-finished";