Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit eb1089a

Browse filesBrowse files
joyeecheungmarco-ippolito
authored andcommitted
lib: do not access process.noDeprecation at build time
Delay access at run time otherwise the value is captured at build time and always false. PR-URL: #51447 Reviewed-By: Jithil P Ponnan <jithil@outlook.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent 049e5f5 commit eb1089a
Copy full SHA for eb1089a

File tree

Expand file treeCollapse file tree

2 files changed

+9
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

2 files changed

+9
-6
lines changed
Open diff view settings
Collapse file

‎lib/internal/fs/utils.js‎

Copy file name to clipboardExpand all lines: lib/internal/fs/utils.js
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -855,8 +855,12 @@ const validateRmOptionsSync = hideStackFrames((path, options, expectDir) => {
855855
return options;
856856
});
857857

858-
let recursiveRmdirWarned = process.noDeprecation;
858+
let recursiveRmdirWarned;
859859
function emitRecursiveRmdirWarning() {
860+
if (recursiveRmdirWarned === undefined) {
861+
// TODO(joyeecheung): use getOptionValue('--no-deprecation') instead.
862+
recursiveRmdirWarned = process.noDeprecation;
863+
}
860864
if (!recursiveRmdirWarned) {
861865
process.emitWarning(
862866
'In future versions of Node.js, fs.rmdir(path, { recursive: true }) ' +
Collapse file

‎lib/internal/util.js‎

Copy file name to clipboardExpand all lines: lib/internal/util.js
+4-5Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,6 @@ function pendingDeprecate(fn, msg, code) {
142142
// Returns a modified function which warns once by default.
143143
// If --no-deprecation is set, then it is a no-op.
144144
function deprecate(fn, msg, code, useEmitSync) {
145-
if (process.noDeprecation === true) {
146-
return fn;
147-
}
148-
149145
// Lazy-load to avoid a circular dependency.
150146
if (validateString === undefined)
151147
({ validateString } = require('internal/validators'));
@@ -158,7 +154,10 @@ function deprecate(fn, msg, code, useEmitSync) {
158154
);
159155

160156
function deprecated(...args) {
161-
emitDeprecationWarning();
157+
// TODO(joyeecheung): use getOptionValue('--no-deprecation') instead.
158+
if (!process.noDeprecation) {
159+
emitDeprecationWarning();
160+
}
162161
if (new.target) {
163162
return ReflectConstruct(fn, args, new.target);
164163
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.