child_process: runtime deprecate _channel
This commit moves DEP0129 to a runtime deprecation. PR-URL: https://github.com/nodejs/node/pull/27949 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
80d9b1c712
commit
d05668d688
@ -2436,12 +2436,15 @@ Node.js versions.
|
|||||||
### DEP0129: ChildProcess._channel
|
### DEP0129: ChildProcess._channel
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
changes:
|
changes:
|
||||||
|
- version: REPLACEME
|
||||||
|
pr-url: https://github.com/nodejs/node/pull/27949
|
||||||
|
description: Runtime deprecation.
|
||||||
- version: v11.14.0
|
- version: v11.14.0
|
||||||
pr-url: https://github.com/nodejs/node/pull/26982
|
pr-url: https://github.com/nodejs/node/pull/26982
|
||||||
description: Documentation-only.
|
description: Documentation-only.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Type: Documentation-only
|
Type: Runtime
|
||||||
|
|
||||||
The `_channel` property of child process objects returned by `spawn()` and
|
The `_channel` property of child process objects returned by `spawn()` and
|
||||||
similar functions is not intended for public use. Use `ChildProcess.channel`
|
similar functions is not intended for public use. Use `ChildProcess.channel`
|
||||||
|
@ -37,7 +37,7 @@ const { TTY } = internalBinding('tty_wrap');
|
|||||||
const { UDP } = internalBinding('udp_wrap');
|
const { UDP } = internalBinding('udp_wrap');
|
||||||
const SocketList = require('internal/socket_list');
|
const SocketList = require('internal/socket_list');
|
||||||
const { owner_symbol } = require('internal/async_hooks').symbols;
|
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 { isArrayBufferView } = require('internal/util/types');
|
||||||
const spawn_sync = internalBinding('spawn_sync');
|
const spawn_sync = internalBinding('spawn_sync');
|
||||||
const { kStateSymbol } = require('internal/dgram');
|
const { kStateSymbol } = require('internal/dgram');
|
||||||
@ -513,14 +513,21 @@ class Control extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const channelDeprecationMsg = '_channel is deprecated. ' +
|
||||||
|
'Use ChildProcess.channel instead.';
|
||||||
|
|
||||||
function setupChannel(target, channel) {
|
function setupChannel(target, channel) {
|
||||||
target.channel = channel;
|
target.channel = channel;
|
||||||
|
|
||||||
// _channel can be deprecated in version 8
|
|
||||||
Object.defineProperty(target, '_channel', {
|
Object.defineProperty(target, '_channel', {
|
||||||
get() { return target.channel; },
|
get: deprecate(() => {
|
||||||
set(val) { target.channel = val; },
|
return target.channel;
|
||||||
enumerable: true
|
}, channelDeprecationMsg, 'DEP0129'),
|
||||||
|
set: deprecate((val) => {
|
||||||
|
target.channel = val;
|
||||||
|
}, channelDeprecationMsg, 'DEP0129'),
|
||||||
|
configurable: true,
|
||||||
|
enumerable: false
|
||||||
});
|
});
|
||||||
|
|
||||||
target._handleQueue = null;
|
target._handleQueue = null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user