diff --git a/lib/internal/child_process.js b/lib/internal/child_process.js index abd4b16d120dc3..999f7d28ffa12a 100644 --- a/lib/internal/child_process.js +++ b/lib/internal/child_process.js @@ -610,10 +610,12 @@ function setupChannel(target, channel) { handle, options); - // If handle was sent twice, or it is impossible to get native handle - // out of it - just send a text without the handle. - if (!handle) - message = message.msg; + // If it is impossible to get a handle, then something unexpected likely + // happened. For example, a socket may have closed while waiting in the + // _handleQueue. + if (!handle) { + return true; + } // Update simultaneous accepts on Windows if (obj.simultaneousAccepts) {