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 91f2cf9

Browse filesBrowse files
santigimenoMylesBorins
authored andcommitted
child_process: fix stdio sockets creation
`readable` and `writable` properties can be passed directly to the `net.Socket` constructor. This change also avoids an unnecessary call to `read(0)` on the `stdin` socket. This behavior was disclosed when trying to merge `libuv@1.19.0` and specifically this commit: libuv/libuv@fd04939. PR-URL: #18701 Refs: libuv/libuv#1655 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 0fc33fb commit 91f2cf9
Copy full SHA for 91f2cf9

File tree

Expand file treeCollapse file tree

2 files changed

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

2 files changed

+2
-12
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-11Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -238,17 +238,7 @@ function flushStdio(subprocess) {
238238

239239

240240
function createSocket(pipe, readable) {
241-
var s = new net.Socket({ handle: pipe });
242-
243-
if (readable) {
244-
s.writable = false;
245-
s.readable = true;
246-
} else {
247-
s.writable = true;
248-
s.readable = false;
249-
}
250-
251-
return s;
241+
return net.Socket({ handle: pipe, readable, writable: !readable });
252242
}
253243

254244

Collapse file

‎test/async-hooks/test-pipewrap.js‎

Copy file name to clipboardExpand all lines: test/async-hooks/test-pipewrap.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ function onexit() {
7878
// Usually it is just one event, but it can be more.
7979
assert.ok(ioEvents >= 3, `at least 3 stdout io events, got ${ioEvents}`);
8080

81-
checkInvocations(pipe1, { init: 1, before: 2, after: 2 },
81+
checkInvocations(pipe1, { init: 1, before: 1, after: 1 },
8282
'pipe wrap when sleep.spawn was called');
8383
checkInvocations(pipe2, { init: 1, before: ioEvents, after: ioEvents },
8484
'pipe wrap when sleep.spawn was called');

0 commit comments

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