lib: move DEP0006 to end of life
This commit moves DEP0006, which has been runtime deprecated since Node 0.11, to end of life status. PR-URL: https://github.com/nodejs/node/pull/25279 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com>
This commit is contained in:
parent
7d453ff212
commit
d4934ae6f2
@ -160,6 +160,9 @@ outside `node_modules` in order to better target developers, rather than users.
|
|||||||
### DEP0006: child\_process options.customFds
|
### DEP0006: child\_process options.customFds
|
||||||
<!-- YAML
|
<!-- YAML
|
||||||
changes:
|
changes:
|
||||||
|
- version: REPLACEME
|
||||||
|
pr-url: https://github.com/nodejs/node/pull/25279
|
||||||
|
description: End-of-Life.
|
||||||
- version:
|
- version:
|
||||||
- v4.8.6
|
- v4.8.6
|
||||||
- v6.12.0
|
- v6.12.0
|
||||||
@ -171,7 +174,7 @@ changes:
|
|||||||
description: Documentation-only deprecation.
|
description: Documentation-only deprecation.
|
||||||
-->
|
-->
|
||||||
|
|
||||||
Type: Runtime
|
Type: End-of-Life
|
||||||
|
|
||||||
Within the [`child_process`][] module's `spawn()`, `fork()`, and `exec()`
|
Within the [`child_process`][] module's `spawn()`, `fork()`, and `exec()`
|
||||||
methods, the `options.customFds` option is deprecated. The `options.stdio`
|
methods, the `options.customFds` option is deprecated. The `options.stdio`
|
||||||
|
@ -22,9 +22,7 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const util = require('util');
|
const util = require('util');
|
||||||
const {
|
const { convertToValidSignal, getSystemErrorName } = require('internal/util');
|
||||||
deprecate, convertToValidSignal, getSystemErrorName
|
|
||||||
} = require('internal/util');
|
|
||||||
const { isArrayBufferView } = require('internal/util/types');
|
const { isArrayBufferView } = require('internal/util/types');
|
||||||
const debug = util.debuglog('child_process');
|
const debug = util.debuglog('child_process');
|
||||||
const { Buffer } = require('buffer');
|
const { Buffer } = require('buffer');
|
||||||
@ -384,20 +382,6 @@ Object.defineProperty(exports.execFile, util.promisify.custom, {
|
|||||||
value: customPromiseExecFunction(exports.execFile)
|
value: customPromiseExecFunction(exports.execFile)
|
||||||
});
|
});
|
||||||
|
|
||||||
const _deprecatedCustomFds = deprecate(
|
|
||||||
function deprecateCustomFds(options) {
|
|
||||||
options.stdio = options.customFds.map(function mapCustomFds(fd) {
|
|
||||||
return fd === -1 ? 'pipe' : fd;
|
|
||||||
});
|
|
||||||
}, 'child_process: options.customFds option is deprecated. ' +
|
|
||||||
'Use options.stdio instead.', 'DEP0006');
|
|
||||||
|
|
||||||
function _convertCustomFds(options) {
|
|
||||||
if (options.customFds && !options.stdio) {
|
|
||||||
_deprecatedCustomFds(options);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function normalizeSpawnArguments(file, args, options) {
|
function normalizeSpawnArguments(file, args, options) {
|
||||||
validateString(file, 'file');
|
validateString(file, 'file');
|
||||||
|
|
||||||
@ -526,8 +510,6 @@ function normalizeSpawnArguments(file, args, options) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_convertCustomFds(options);
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
file: file,
|
file: file,
|
||||||
args: args,
|
args: args,
|
||||||
|
@ -1,47 +0,0 @@
|
|||||||
// Flags: --expose_internals
|
|
||||||
'use strict';
|
|
||||||
const common = require('../common');
|
|
||||||
const assert = require('assert');
|
|
||||||
const { spawnSync } = require('child_process');
|
|
||||||
const internalCp = require('internal/child_process');
|
|
||||||
|
|
||||||
if (!common.isMainThread)
|
|
||||||
common.skip('stdio is not associated with file descriptors in Workers');
|
|
||||||
|
|
||||||
// This test uses the deprecated `customFds` option. We expect a deprecation
|
|
||||||
// warning, but only once (per node process).
|
|
||||||
const msg = 'child_process: options.customFds option is deprecated. ' +
|
|
||||||
'Use options.stdio instead.';
|
|
||||||
common.expectWarning('DeprecationWarning', msg, 'DEP0006');
|
|
||||||
|
|
||||||
// Verify that customFds is used if stdio is not provided.
|
|
||||||
{
|
|
||||||
const customFds = [-1, process.stdout.fd, process.stderr.fd];
|
|
||||||
const oldSpawnSync = internalCp.spawnSync;
|
|
||||||
internalCp.spawnSync = common.mustCall(function(opts) {
|
|
||||||
assert.deepStrictEqual(opts.options.customFds, customFds);
|
|
||||||
assert.deepStrictEqual(opts.options.stdio, [
|
|
||||||
{ type: 'pipe', readable: true, writable: false },
|
|
||||||
{ type: 'fd', fd: process.stdout.fd },
|
|
||||||
{ type: 'fd', fd: process.stderr.fd }
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
spawnSync(...common.pwdCommand, { customFds });
|
|
||||||
internalCp.spawnSync = oldSpawnSync;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Verify that customFds is ignored when stdio is present.
|
|
||||||
{
|
|
||||||
const customFds = [0, 1, 2];
|
|
||||||
const oldSpawnSync = internalCp.spawnSync;
|
|
||||||
internalCp.spawnSync = common.mustCall(function(opts) {
|
|
||||||
assert.deepStrictEqual(opts.options.customFds, customFds);
|
|
||||||
assert.deepStrictEqual(opts.options.stdio, [
|
|
||||||
{ type: 'pipe', readable: true, writable: false },
|
|
||||||
{ type: 'pipe', readable: false, writable: true },
|
|
||||||
{ type: 'pipe', readable: false, writable: true }
|
|
||||||
]);
|
|
||||||
});
|
|
||||||
spawnSync(...common.pwdCommand, { customFds, stdio: 'pipe' });
|
|
||||||
internalCp.spawnSync = oldSpawnSync;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user