mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Use is-reachable to detect child process health in self-test.
On Linux, child processes that have exited may remain as <defunct> "zombie" processes, which prevents process.kill(childPid, 0) from throwing, so we need a different trick for detecting whether the child process is still alive.
This commit is contained in:
@@ -41,6 +41,7 @@ var packageJson = {
|
||||
sqlite3: "3.1.8",
|
||||
netroute: "1.0.2",
|
||||
"http-proxy": "1.16.2",
|
||||
"is-reachable": "3.1.0",
|
||||
"wordwrap": "0.0.2",
|
||||
"moment": "2.20.1",
|
||||
"rimraf": "2.6.2",
|
||||
|
||||
@@ -7,6 +7,7 @@ var _ = require('underscore');
|
||||
var files = require('../fs/files.js');
|
||||
var catalog = require('../packaging/catalog/catalog.js');
|
||||
var os = require('os');
|
||||
var isReachable = require("is-reachable");
|
||||
|
||||
var DEFAULT_RELEASE_TRACK = catalog.DEFAULT_TRACK;
|
||||
|
||||
@@ -377,6 +378,10 @@ selftest.define("run and SIGKILL parent process", ["yet-unsolved-windows-failure
|
||||
}
|
||||
childPid = match[1];
|
||||
|
||||
if (!isReachable("localhost:3000").await()) {
|
||||
selftest.fail("Child process " + childPid + " already dead?");
|
||||
}
|
||||
|
||||
process.kill(run.proc.pid, "SIGKILL");
|
||||
// This sleep should be a little more time than the interval at which
|
||||
// the child checks if the parent is still alive, in
|
||||
@@ -386,14 +391,7 @@ selftest.define("run and SIGKILL parent process", ["yet-unsolved-windows-failure
|
||||
// Send the child process a signal of 0. If there is no error, it
|
||||
// means that the process is still running, which is not what we
|
||||
// expect.
|
||||
var caughtError;
|
||||
try {
|
||||
process.kill(childPid, 0);
|
||||
} catch (err) {
|
||||
caughtError = err;
|
||||
}
|
||||
|
||||
if (! caughtError) {
|
||||
if (isReachable("localhost:3000").await()) {
|
||||
selftest.fail("Child process " + childPid + " is still running");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user