mirror of
https://github.com/nodejs/node.git
synced 2025-05-05 15:32:15 +00:00

This commit adds a test that attempts to send data over an IPC channel once it has been closed. PR-URL: https://github.com/nodejs/node/pull/8160 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
29 lines
710 B
JavaScript
29 lines
710 B
JavaScript
'use strict';
|
|
const common = require('../common');
|
|
const assert = require('assert');
|
|
const cp = require('child_process');
|
|
const path = require('path');
|
|
const fixture = path.join(common.fixturesDir, 'empty.js');
|
|
const child = cp.fork(fixture);
|
|
|
|
child.on('close', common.mustCall((code, signal) => {
|
|
assert.strictEqual(code, 0);
|
|
assert.strictEqual(signal, null);
|
|
|
|
function testError(err) {
|
|
assert.strictEqual(err.message, 'channel closed');
|
|
}
|
|
|
|
child.on('error', common.mustCall(testError));
|
|
|
|
{
|
|
const result = child.send('ping');
|
|
assert.strictEqual(result, false);
|
|
}
|
|
|
|
{
|
|
const result = child.send('pong', common.mustCall(testError));
|
|
assert.strictEqual(result, false);
|
|
}
|
|
}));
|