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 d2b5dcb

Browse filesBrowse files
Trottrvagg
authored andcommitted
lib: return boolean from child.send()
Previous change reinstated returning boolean from child.send() but missed one instance where undefined might be returned instead. PR-URL: #3577 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
1 parent 90723af commit d2b5dcb
Copy full SHA for d2b5dcb

File tree

Expand file treeCollapse file tree

2 files changed

+22
-2
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+22
-2
lines changed
Open diff view settings
Collapse file

‎lib/internal/child_process.js‎

Copy file name to clipboardExpand all lines: lib/internal/child_process.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ function setupChannel(target, channel) {
551551
handle: handle,
552552
message: message.msg,
553553
});
554-
return;
554+
return this._handleQueue.length === 1;
555555
}
556556

557557
var obj = handleConversion[message.type];
Collapse file
+21-1Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,29 @@
11
'use strict';
22
const common = require('../common');
33
const assert = require('assert');
4+
const path = require('path');
5+
const net = require('net');
46
const fork = require('child_process').fork;
7+
const spawn = require('child_process').spawn;
58

6-
const n = fork(common.fixturesDir + '/empty.js');
9+
const emptyFile = path.join(common.fixturesDir, 'empty.js');
10+
11+
const n = fork(emptyFile);
712

813
const rv = n.send({ hello: 'world' });
914
assert.strictEqual(rv, true);
15+
16+
const spawnOptions = { stdio: ['pipe', 'pipe', 'pipe', 'ipc'] };
17+
const s = spawn(process.execPath, [emptyFile], spawnOptions);
18+
var handle = null;
19+
s.on('exit', function() {
20+
handle.close();
21+
});
22+
23+
net.createServer(common.fail).listen(common.PORT, function() {
24+
handle = this._handle;
25+
assert.strictEqual(s.send('one', handle), true);
26+
assert.strictEqual(s.send('two', handle), true);
27+
assert.strictEqual(s.send('three'), false);
28+
assert.strictEqual(s.send('four'), false);
29+
});

0 commit comments

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