File tree Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Expand file tree Collapse file tree 3 files changed +29
-3
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,31 @@ process.domain = null;
86
86
}
87
87
process . _exiting = false ;
88
88
89
+ {
90
+ const warnIntegerCoercionDeprecation = deprecate (
91
+ ( ) => { } ,
92
+ 'Implicit coercion to interger for `exit code` is deprecated.' ,
93
+ 'DEP0164'
94
+ ) ;
95
+
96
+ let exitCode ;
97
+
98
+ ObjectDefineProperty ( process , 'exitCode' , {
99
+ __proto__ : null ,
100
+ get ( ) {
101
+ return exitCode ;
102
+ } ,
103
+ set ( code ) {
104
+ if ( perThreadSetup . isDeprecatedExitCode ( code ) ) {
105
+ warnIntegerCoercionDeprecation ( ) ;
106
+ }
107
+ exitCode = code ;
108
+ } ,
109
+ enumerable : true ,
110
+ configurable : false ,
111
+ } ) ;
112
+ }
113
+
89
114
// process.config is serialized config.gypi
90
115
const nativeModule = internalBinding ( 'builtins' ) ;
91
116
Original file line number Diff line number Diff line change @@ -185,7 +185,7 @@ function wrapProcessMethods(binding) {
185
185
const { deprecate } = require ( 'internal/util' ) ;
186
186
const warnIntegerCoercionDeprecationSync = deprecate (
187
187
( ) => { } ,
188
- 'Implicit coercion to interger for `code` is deprecated.' ,
188
+ 'Implicit coercion to interger for `exit code` is deprecated.' ,
189
189
'DEP0164' ,
190
190
true
191
191
) ;
@@ -448,4 +448,5 @@ module.exports = {
448
448
hrtime,
449
449
hrtimeBigInt,
450
450
refreshHrtimeBuffer,
451
+ isDeprecatedExitCode,
451
452
} ;
Original file line number Diff line number Diff line change @@ -82,8 +82,8 @@ if (process.argv[2] === undefined) {
82
82
for ( const index of args . keys ( ) ) {
83
83
// Check `process.exit([code])`
84
84
test ( index ) ;
85
- // TODO: Check exit with `process.exitCode`
86
- // test(index, true);
85
+ // Check exit with `process.exitCode`
86
+ test ( index , true ) ;
87
87
}
88
88
} else {
89
89
const index = parseInt ( process . argv [ 2 ] ) ;
You can’t perform that action at this time.
0 commit comments