From b15dc9584836f2dc24aa18852899fc3d29b46fac Mon Sep 17 00:00:00 2001 From: Santiago Gimeno Date: Sat, 1 Apr 2017 20:44:36 +0200 Subject: [PATCH] test: fix flaky test-child-process-exec-timeout MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At least starting with Darwin Kernel Version 16.4.0, sending a SIGTERM to a process that is still starting up kills it with SIGKILL instead of SIGTERM. PR-URL: https://github.com/nodejs/node/pull/12159 Refs: https://github.com/libuv/libuv/issues/1226 Reviewed-By: Rich Trott Reviewed-By: Ben Noordhuis Reviewed-By: Richard Lau Reviewed-By: Michaƫl Zasso Reviewed-By: Gibson Fahnestock Reviewed-By: Yuta Hiroto Reviewed-By: Colin Ihrig Reviewed-By: James M Snell --- test/parallel/test-child-process-exec-timeout.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/test/parallel/test-child-process-exec-timeout.js b/test/parallel/test-child-process-exec-timeout.js index b28fdf6581a9f4..63534d8cbc3e01 100644 --- a/test/parallel/test-child-process-exec-timeout.js +++ b/test/parallel/test-child-process-exec-timeout.js @@ -18,7 +18,13 @@ const cmd = `${process.execPath} ${__filename} child`; cp.exec(cmd, { timeout: 1 }, common.mustCall((err, stdout, stderr) => { assert.strictEqual(err.killed, true); assert.strictEqual(err.code, null); - assert.strictEqual(err.signal, 'SIGTERM'); + // At least starting with Darwin Kernel Version 16.4.0, sending a SIGTERM to a + // process that is still starting up kills it with SIGKILL instead of SIGTERM. + // See: https://github.com/libuv/libuv/issues/1226 + if (common.isOSX) + assert.ok(err.signal === 'SIGTERM' || err.signal === 'SIGKILL'); + else + assert.strictEqual(err.signal, 'SIGTERM'); assert.strictEqual(err.cmd, cmd); assert.strictEqual(stdout.trim(), ''); assert.strictEqual(stderr.trim(), '');