process: add --pending-deprecation to process.binding()

Print a deprecation warning for `process.binding()` when using
`--pending-deprecation`.

PR-URL: https://github.com/nodejs/node/pull/26500
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Minwoo Jung <minwoo@nodesource.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Masashi Hirano <shisama07@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Anto Aravinth <anto.aravinth.cse@gmail.com>
This commit is contained in:
Anna Henningsen 2019-02-25 22:28:35 +01:00
parent 137d3d2734
commit 1482547441
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
3 changed files with 19 additions and 7 deletions

View File

@ -2134,9 +2134,12 @@ changes:
- version: v10.9.0
pr-url: https://github.com/nodejs/node/pull/22004
description: Documentation-only deprecation.
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/26500
description: Added support for `--pending-deprecation`.
-->
Type: Documentation-only
Type: Documentation-only (supports [`--pending-deprecation`][])
`process.binding()` is for use by Node.js internal code only.

View File

@ -195,6 +195,12 @@ function initializeDeprecations() {
value: noBrowserGlobals
});
}
if (pendingDeprecation) {
process.binding = deprecate(process.binding,
'process.binding() is deprecated. ' +
'Please use public APIs instead.', 'DEP0111');
}
}
function setupChildProcessIpcChannel() {

View File

@ -3,11 +3,14 @@ const common = require('../common');
// Flags: --pending-deprecation
common.expectWarning(
'DeprecationWarning',
'Directly calling process.binding(\'uv\').errname(<val>) is being ' +
'deprecated. Please make sure to use util.getSystemErrorName() instead.',
'DEP0119'
);
common.expectWarning({
DeprecationWarning: [
['process.binding() is deprecated. Please use public APIs instead.',
'DEP0111'],
['Directly calling process.binding(\'uv\').errname(<val>) is being ' +
'deprecated. Please make sure to use util.getSystemErrorName() instead.',
'DEP0119']
]
});
process.binding('uv').errname(-1);