fix(cli): guard against read-only process.noDeprecation on Node.js v23+ (#14152)
Merged via /review-pr -> /prepare-pr -> /merge-pr. Prepared head SHA: 11bb9f141ae01d85c7eb8d4f8b526d7bda419558 Co-authored-by: 0xRaini <190923101+0xRaini@users.noreply.github.com> Co-authored-by: steipete <58493+steipete@users.noreply.github.com> Reviewed-by: @steipete
This commit is contained in:
16
src/cli/update-cli/suppress-deprecations.ts
Normal file
16
src/cli/update-cli/suppress-deprecations.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
/**
|
||||
* Suppress Node.js deprecation warnings.
|
||||
*
|
||||
* On Node.js v23+ `process.noDeprecation` may be a read-only property
|
||||
* (defined via a getter on the prototype with no setter), so the
|
||||
* assignment can throw. We fall back to the environment variable which
|
||||
* achieves the same effect.
|
||||
*/
|
||||
export function suppressDeprecations(): void {
|
||||
try {
|
||||
process.noDeprecation = true;
|
||||
} catch {
|
||||
// read-only on Node v23+; NODE_NO_WARNINGS below covers this case
|
||||
}
|
||||
process.env.NODE_NO_WARNINGS = "1";
|
||||
}
|
||||
Reference in New Issue
Block a user