Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: move DEP0129 to a runtime deprecation #27949

Merged
merged 1 commit into from
May 31, 2019
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 @@ -2436,12 +2436,15 @@ Node.js versions.
### DEP0129: ChildProcess._channel
<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/27949
description: Runtime deprecation.
- version: v11.14.0
pr-url: https://github.com/nodejs/node/pull/26982
description: Documentation-only.
-->

Type: Documentation-only
Type: Runtime

The `_channel` property of child process objects returned by `spawn()` and
similar functions is not intended for public use. Use `ChildProcess.channel`
Expand Down
17 changes: 12 additions & 5 deletions lib/internal/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,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 } = require('internal/util');
const { convertToValidSignal, deprecate } = require('internal/util');
const { isArrayBufferView } = require('internal/util/types');
const spawn_sync = internalBinding('spawn_sync');
const { kStateSymbol } = require('internal/dgram');
Expand Down Expand Up @@ -513,14 +513,21 @@ class Control extends EventEmitter {
}
}

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

function setupChannel(target, channel) {
target.channel = channel;

// _channel can be deprecated in version 8
Object.defineProperty(target, '_channel', {
get() { return target.channel; },
set(val) { target.channel = val; },
enumerable: true
get: deprecate(() => {
return target.channel;
}, channelDeprecationMsg, 'DEP0129'),
set: deprecate((val) => {
target.channel = val;
}, channelDeprecationMsg, 'DEP0129'),
configurable: true,
enumerable: false
});

target._handleQueue = null;
Expand Down