diff options
author | Anna Henningsen <anna@addaleax.net> | 2019-10-29 22:15:31 +0300 |
---|---|---|
committer | Ruben Bridgewater <ruben@bridgewater.de> | 2020-01-03 18:32:36 +0300 |
commit | e65bed1b7e273d1db6ba5905c8f68338b06cd27a (patch) | |
tree | c5f14b0abe3014e268068b4040af90c3ee9a7e4a /lib/internal/bootstrap | |
parent | d6a2badef780b670b80117f2381e345a75fc0d65 (diff) |
child_process: create proper public API for `channel`
Instead of exposing the C++ bindings object as `subprocess.channel`
or `process.channel`, provide the “control” object that was
previously used internally as the public-facing variant of it.
This should be better than returning the raw pipe object, and
matches the original intention (when the `channel` property was
first added) of providing a proper way to `.ref()` or `.unref()`
the channel.
PR-URL: https://github.com/nodejs/node/pull/30165
Refs: https://github.com/nodejs/node/pull/9322
Refs: https://github.com/nodejs/node/issues/9313
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib/internal/bootstrap')
-rw-r--r-- | lib/internal/bootstrap/switches/is_main_thread.js | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/internal/bootstrap/switches/is_main_thread.js b/lib/internal/bootstrap/switches/is_main_thread.js index 4f7ef7b6a69..98ba8a79262 100644 --- a/lib/internal/bootstrap/switches/is_main_thread.js +++ b/lib/internal/bootstrap/switches/is_main_thread.js @@ -91,8 +91,9 @@ function createWritableStdioStream(fd) { // 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) { + const { kChannelHandle } = require('internal/child_process'); stream = new net.Socket({ - handle: process.channel, + handle: process[kChannelHandle], readable: false, writable: true }); |