Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2705,6 +2705,9 @@ Node.js versions.

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/58527
description: End-of-Life.
- version: v13.0.0
pr-url: https://github.com/nodejs/node/pull/27949
description: Runtime deprecation.
Expand All @@ -2713,7 +2716,7 @@ changes:
description: Documentation-only.
-->

Type: Runtime
Type: End-of-Life

The `_channel` property of child process objects returned by `spawn()` and
similar functions is not intended for public use. Use `ChildProcess.channel`
Expand Down
18 changes: 1 addition & 17 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const {
ArrayPrototypeSlice,
FunctionPrototype,
FunctionPrototypeCall,
ObjectDefineProperty,
ObjectSetPrototypeOf,
ReflectApply,
StringPrototypeSlice,
Expand Down Expand Up @@ -56,7 +55,7 @@ const { TTY } = internalBinding('tty_wrap');
const { UDP } = internalBinding('udp_wrap');
const SocketList = require('internal/socket_list');
const { owner_symbol } = require('internal/async_hooks').symbols;
const { convertToValidSignal, deprecate } = require('internal/util');
const { convertToValidSignal } = require('internal/util');
const { isArrayBufferView } = require('internal/util/types');
const spawn_sync = internalBinding('spawn_sync');
const { kStateSymbol } = require('internal/dgram');
Expand Down Expand Up @@ -575,27 +574,12 @@ class Control extends EventEmitter {
}
}

const channelDeprecationMsg = '_channel is deprecated. ' +
'Use ChildProcess.channel instead.';

let serialization;
function setupChannel(target, channel, serializationMode) {
const control = new Control(channel);
target.channel = control;
target[kChannelHandle] = channel;

ObjectDefineProperty(target, '_channel', {
__proto__: null,
get: deprecate(() => {
return target.channel;
}, channelDeprecationMsg, 'DEP0129'),
set: deprecate((val) => {
target.channel = val;
}, channelDeprecationMsg, 'DEP0129'),
configurable: true,
enumerable: false,
});

target._handleQueue = null;
target._pendingMessage = null;

Expand Down
2 changes: 0 additions & 2 deletions test/parallel/test-child-process-fork.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// Flags: --no-warnings
'use strict';
const common = require('../common');
const assert = require('assert');
Expand All @@ -29,7 +28,6 @@ const debug = require('util').debuglog('test');

const n = fork(fixtures.path('child-process-spawn-node.js'), args);

assert.strictEqual(n.channel, n._channel);
assert.deepStrictEqual(args, ['foo', 'bar']);

n.on('message', (m) => {
Expand Down
Loading