diff --git a/scripts/dev-bundle-tool-package.js b/scripts/dev-bundle-tool-package.js index 3dda1a360c..6129b9f1b6 100644 --- a/scripts/dev-bundle-tool-package.js +++ b/scripts/dev-bundle-tool-package.js @@ -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", diff --git a/tools/tests/run.js b/tools/tests/run.js index e69d280680..f5a1288738 100644 --- a/tools/tests/run.js +++ b/tools/tests/run.js @@ -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"); }