Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 498238f

Browse filesBrowse files
cjihrigevanlucas
authored andcommitted
test: test sending over a closed IPC channel
This commit adds a test that attempts to send data over an IPC channel once it has been closed. PR-URL: #8160 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: Claudio Rodriguez <cjrodr@yahoo.com>
1 parent 15bd489 commit 498238f
Copy full SHA for 498238f

File tree

Expand file treeCollapse file tree

1 file changed

+28
-0
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+28
-0
lines changed
Open diff view settings
Collapse file
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
'use strict';
2+
const common = require('../common');
3+
const assert = require('assert');
4+
const cp = require('child_process');
5+
const path = require('path');
6+
const fixture = path.join(common.fixturesDir, 'empty.js');
7+
const child = cp.fork(fixture);
8+
9+
child.on('close', common.mustCall((code, signal) => {
10+
assert.strictEqual(code, 0);
11+
assert.strictEqual(signal, null);
12+
13+
function testError(err) {
14+
assert.strictEqual(err.message, 'channel closed');
15+
}
16+
17+
child.on('error', common.mustCall(testError));
18+
19+
{
20+
const result = child.send('ping');
21+
assert.strictEqual(result, false);
22+
}
23+
24+
{
25+
const result = child.send('pong', common.mustCall(testError));
26+
assert.strictEqual(result, false);
27+
}
28+
}));

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.