test: improve test-process-kill-null for Windows
PR-URL: https://github.com/nodejs/node/pull/14099 Reviewed-By: Refael Ackermann <refack@gmail.com>
This commit is contained in:
parent
b647f04df1
commit
44483b6898
@ -20,29 +20,23 @@
|
||||
// USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
'use strict';
|
||||
require('../common');
|
||||
const common = require('../common');
|
||||
const assert = require('assert');
|
||||
const spawn = require('child_process').spawn;
|
||||
|
||||
const cat = spawn('cat');
|
||||
let called;
|
||||
const child = common.isWindows ? spawn('cmd.exe') : spawn('cat');
|
||||
|
||||
assert.ok(process.kill(cat.pid, 0));
|
||||
assert.ok(process.kill(child.pid, 0));
|
||||
|
||||
cat.on('exit', function() {
|
||||
child.on('exit', common.mustCall(function() {
|
||||
assert.throws(function() {
|
||||
process.kill(cat.pid, 0);
|
||||
process.kill(child.pid, 0);
|
||||
}, Error);
|
||||
});
|
||||
}));
|
||||
|
||||
cat.stdout.on('data', function() {
|
||||
called = true;
|
||||
process.kill(cat.pid, 'SIGKILL');
|
||||
});
|
||||
child.stdout.on('data', common.mustCall(function() {
|
||||
process.kill(child.pid, 'SIGKILL');
|
||||
}));
|
||||
|
||||
// EPIPE when null sig fails
|
||||
cat.stdin.write('test');
|
||||
|
||||
process.on('exit', function() {
|
||||
assert.ok(called);
|
||||
});
|
||||
child.stdin.write('test');
|
||||
|
Loading…
x
Reference in New Issue
Block a user