From d69ecc6f51855574b8f0af1004e6d0ffd9b20c7a Mon Sep 17 00:00:00 2001 From: Refael Ackermann Date: Sat, 8 Jul 2017 23:50:01 -0400 Subject: [PATCH] Revert "test: improve test-process-kill-null for Windows" This reverts commit 44483b6898128b05c09635e03e4d7ceaf3efb14c. PR-URL: https://github.com/nodejs/node/pull/14142 Fixes: https://github.com/nodejs/node/issues/14141 Refs: https://github.com/nodejs/node/pull/14099 Reviewed-By: Rich Trott Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig --- test/parallel/test-process-kill-null.js | 26 +++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/test/parallel/test-process-kill-null.js b/test/parallel/test-process-kill-null.js index c604fd8abfa3d4..023724773f6276 100644 --- a/test/parallel/test-process-kill-null.js +++ b/test/parallel/test-process-kill-null.js @@ -20,23 +20,29 @@ // USE OR OTHER DEALINGS IN THE SOFTWARE. 'use strict'; -const common = require('../common'); +require('../common'); const assert = require('assert'); const spawn = require('child_process').spawn; -const child = common.isWindows ? spawn('cmd.exe') : spawn('cat'); +const cat = spawn('cat'); +let called; -assert.ok(process.kill(child.pid, 0)); +assert.ok(process.kill(cat.pid, 0)); -child.on('exit', common.mustCall(function() { +cat.on('exit', function() { assert.throws(function() { - process.kill(child.pid, 0); + process.kill(cat.pid, 0); }, Error); -})); +}); -child.stdout.on('data', common.mustCall(function() { - process.kill(child.pid, 'SIGKILL'); -})); +cat.stdout.on('data', function() { + called = true; + process.kill(cat.pid, 'SIGKILL'); +}); // EPIPE when null sig fails -child.stdin.write('test'); +cat.stdin.write('test'); + +process.on('exit', function() { + assert.ok(called); +});