| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 19f3973 commit 2d0d997
7 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3178,6 +3178,9 @@ thing instead. | |||
| 3178 | 3178 | ||
| 3179 | 3179 | <!-- YAML | |
| 3180 | 3180 | changes: | |
| 3181 | + - version: REPLACEME | ||
| 3182 | + pr-url: https://github.com/nodejs/node/pull/43716 | ||
| 3183 | + description: End-of-Life. | ||
| 3181 | 3184 | - version: v19.0.0 | |
| 3182 | 3185 | pr-url: https://github.com/nodejs/node/pull/44711 | |
| 3183 | 3186 | description: Runtime deprecation. | |
@@ -3195,7 +3198,7 @@ changes: | |||
| 3195 | 3198 | coercion. | |
| 3196 | 3199 | --> | |
| 3197 | 3200 | ||
| 3198 | - Type: Runtime | ||
| 3201 | + Type: End-of-Life | ||
| 3199 | 3202 | ||
| 3200 | 3203 | Values other than `undefined`, `null`, integer numbers, and integer strings | |
| 3201 | 3204 | (e.g., `'1'`) are deprecated as value for the `code` parameter in | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1708,9 +1708,15 @@ that started the Node.js process. Symbolic links, if any, are resolved. | |||
| 1708 | 1708 | ||
| 1709 | 1709 | <!-- YAML | |
| 1710 | 1710 | added: v0.1.13 | |
| 1711 | + changes: | ||
| 1712 | + - version: REPLACEME | ||
| 1713 | + pr-url: https://github.com/nodejs/node/pull/43716 | ||
| 1714 | + description: Only accepts a code of type number, or of type string if it | ||
| 1715 | + represents an integer. | ||
| 1711 | 1716 | --> | |
| 1712 | 1717 | ||
| 1713 | - * `code` {integer} The exit code. **Default:** `0`. | ||
| 1718 | + * `code` {integer|string|null|undefined} The exit code. For string type, only | ||
| 1719 | + integer strings (e.g.,'1') are allowed. **Default:** `0`. | ||
| 1714 | 1720 | ||
| 1715 | 1721 | The `process.exit()` method instructs Node.js to terminate the process | |
| 1716 | 1722 | synchronously with an exit status of `code`. If `code` is omitted, exit uses | |
@@ -1810,9 +1816,15 @@ than the current process. | |||
| 1810 | 1816 | ||
| 1811 | 1817 | <!-- YAML | |
| 1812 | 1818 | added: v0.11.8 | |
| 1819 | + changes: | ||
| 1820 | + - version: REPLACEME | ||
| 1821 | + pr-url: https://github.com/nodejs/node/pull/43716 | ||
| 1822 | + description: Only accepts a code of type number, or of type string if it | ||
| 1823 | + represents an integer. | ||
| 1813 | 1824 | --> | |
| 1814 | 1825 | ||
| 1815 | - * {integer} | ||
| 1826 | + * {integer|string|null|undefined} The exit code. For string type, only | ||
| 1827 | + integer strings (e.g.,'1') are allowed. **Default:** `undefined`. | ||
| 1816 | 1828 | ||
| 1817 | 1829 | A number which will be the process exit code, when the process either | |
| 1818 | 1830 | exits gracefully, or is exited via [`process.exit()`][] without specifying | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -60,6 +60,8 @@ const { | |||
| 60 | 60 | ArrayPrototypeFill, | |
| 61 | 61 | FunctionPrototypeCall, | |
| 62 | 62 | JSONParse, | |
| 63 | + Number, | ||
| 64 | + NumberIsNaN, | ||
| 63 | 65 | ObjectDefineProperty, | |
| 64 | 66 | ObjectGetPrototypeOf, | |
| 65 | 67 | ObjectSetPrototypeOf, | |
@@ -74,6 +76,9 @@ const { | |||
| 74 | 76 | deprecate, | |
| 75 | 77 | exposeInterface, | |
| 76 | 78 | } = require('internal/util'); | |
| 79 | + const { | ||
| 80 | + validateInteger, | ||
| 81 | + } = require('internal/validators'); | ||
| 77 | 82 | const { | |
| 78 | 83 | exiting_aliased_Uint32Array, | |
| 79 | 84 | getHiddenValue, | |
@@ -103,12 +108,6 @@ process.domain = null; | |||
| 103 | 108 | process._exiting = false; | |
| 104 | 109 | ||
| 105 | 110 | { | |
| 106 | - const warnIntegerCoercionDeprecation = deprecate( | ||
| 107 | - () => {}, | ||
| 108 | - 'Implicit coercion to integer for exit code is deprecated.', | ||
| 109 | - 'DEP0164' | ||
| 110 | - ); | ||
| 111 | - | ||
| 112 | 111 | let exitCode; | |
| 113 | 112 | ||
| 114 | 113 | ObjectDefineProperty(process, 'exitCode', { | |
@@ -117,8 +116,13 @@ process._exiting = false; | |||
| 117 | 116 | return exitCode; | |
| 118 | 117 | }, | |
| 119 | 118 | set(code) { | |
| 120 | - if (perThreadSetup.isDeprecatedExitCode(code)) { | ||
| 121 | - warnIntegerCoercionDeprecation(); | ||
| 119 | + if (code !== null && code !== undefined) { | ||
| 120 | + let value = code; | ||
| 121 | + if (typeof code === 'string' && code !== '' && | ||
| 122 | + NumberIsNaN((value = Number(code)))) { | ||
| 123 | + value = code; | ||
| 124 | + } | ||
| 125 | + validateInteger(value, 'code'); | ||
| 122 | 126 | } | |
| 123 | 127 | exitCode = code; | |
| 124 | 128 | }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -13,10 +13,7 @@ const { | |||
| 13 | 13 | ArrayPrototypeSplice, | |
| 14 | 14 | BigUint64Array, | |
| 15 | 15 | Float64Array, | |
| 16 | - Number, | ||
| 17 | - NumberIsInteger, | ||
| 18 | 16 | NumberMAX_SAFE_INTEGER, | |
| 19 | - NumberMIN_SAFE_INTEGER, | ||
| 20 | 17 | ObjectFreeze, | |
| 21 | 18 | ObjectDefineProperty, | |
| 22 | 19 | ReflectApply, | |
@@ -183,25 +180,12 @@ function wrapProcessMethods(binding) { | |||
| 183 | 180 | ||
| 184 | 181 | memoryUsage.rss = rss; | |
| 185 | 182 | ||
| 186 | - const { deprecate } = require('internal/util'); | ||
| 187 | - const warnIntegerCoercionDeprecationSync = deprecate( | ||
| 188 | - () => {}, | ||
| 189 | - 'Implicit coercion to integer for exit code is deprecated.', | ||
| 190 | - 'DEP0164', | ||
| 191 | - true | ||
| 192 | - ); | ||
| 193 | - | ||
| 194 | 183 | function exit(code) { | |
| 195 | 184 | process.off('exit', handleProcessExit); | |
| 196 | 185 | ||
| 197 | - if (isDeprecatedExitCode(code)) { | ||
| 198 | - // Emit the deprecation warning synchronously since deprecation warning is | ||
| 199 | - // generally emitted in a next tick but we have no next tick timing here. | ||
| 200 | - warnIntegerCoercionDeprecationSync(); | ||
| 201 | - } | ||
| 202 | - | ||
| 203 | - if (code || code === 0) | ||
| 186 | + if (arguments.length !== 0) { | ||
| 204 | 187 | process.exitCode = code; | |
| 188 | + } | ||
| 205 | 189 | ||
| 206 | 190 | if (!process._exiting) { | |
| 207 | 191 | process._exiting = true; | |
@@ -424,23 +408,6 @@ function toggleTraceCategoryState(asyncHooksEnabled) { | |||
| 424 | 408 | } | |
| 425 | 409 | } | |
| 426 | 410 | ||
| 427 | - function isDeprecatedExitCode(code) { | ||
| 428 | - if (code !== null && code !== undefined) { | ||
| 429 | - const value = | ||
| 430 | - typeof code === 'string' && code !== '' ? Number(code) : code; | ||
| 431 | - // Check if the value is an integer. | ||
| 432 | - if ( | ||
| 433 | - typeof value !== 'number' || | ||
| 434 | - !NumberIsInteger(value) || | ||
| 435 | - value < NumberMIN_SAFE_INTEGER || | ||
| 436 | - value > NumberMAX_SAFE_INTEGER | ||
| 437 | - ) { | ||
| 438 | - return true; | ||
| 439 | - } | ||
| 440 | - } | ||
| 441 | - return false; | ||
| 442 | - } | ||
| 443 | - | ||
| 444 | 411 | module.exports = { | |
| 445 | 412 | toggleTraceCategoryState, | |
| 446 | 413 | assert, | |
@@ -449,5 +416,4 @@ module.exports = { | |||
| 449 | 416 | hrtime, | |
| 450 | 417 | hrtimeBigInt, | |
| 451 | 418 | refreshHrtimeBuffer, | |
| 452 | - isDeprecatedExitCode, | ||
| 453 | 419 | }; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments