We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c54f4bc commit 0187e3bCopy full SHA for 0187e3b
lib/internal/process/stdio.js
@@ -161,11 +161,24 @@ function createWritableStdioStream(fd) {
161
case 'PIPE':
162
case 'TCP':
163
var net = require('net');
164
- stream = new net.Socket({
165
- fd: fd,
166
- readable: false,
167
- writable: true
168
- });
+
+ // If fd is already being used for the IPC channel, libuv will return
+ // an error when trying to use it again. In that case, create the socket
+ // using the existing handle instead of the fd.
+ if (process.channel && process.channel.fd === fd) {
169
+ stream = new net.Socket({
170
+ handle: process.channel,
171
+ readable: false,
172
+ writable: true
173
+ });
174
+ } else {
175
176
+ fd,
177
178
179
180
+ }
181
182
stream._type = 'pipe';
183
break;
184
0 commit comments