Skip to content

Commit

Permalink
Revert "test: improve test-process-kill-null for Windows"
Browse files Browse the repository at this point in the history
This reverts commit 44483b6.

PR-URL: #14142
Fixes: #14141
Refs: #14099
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
  • Loading branch information
refack committed Jul 9, 2017
1 parent d2aaf82 commit d69ecc6
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions test/parallel/test-process-kill-null.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});

0 comments on commit d69ecc6

Please sign in to comment.