GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — process: avoid using the same fd for ipc and stdio · nodejs/node@cd2b80c

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/process
    • stdio.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/process/stdio.js‎

Copy file name to clipboardExpand all lines: lib/internal/process/stdio.js
+18-5Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -182,11 +182,24 @@ function createWritableStdioStream(fd) {
182182
case 'PIPE':
183183
case 'TCP':
184184
var net = require('net');
185-
stream = new net.Socket({
186-
fd: fd,
187-
readable: false,
188-
writable: true
189-
});
185+
186+
// If fd is already being used for the IPC channel, libuv will return
187+
// an error when trying to use it again. In that case, create the socket
188+
// using the existing handle instead of the fd.
189+
if (process.channel && process.channel.fd === fd) {
190+
stream = new net.Socket({
191+
handle: process.channel,
192+
readable: false,
193+
writable: true
194+
});
195+
} else {
196+
stream = new net.Socket({
197+
fd,
198+
readable: false,
199+
writable: true
200+
});
201+
}
202+
190203
stream._type = 'pipe';
191204
break;
192205

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.