File tree 2 files changed +25
-6
lines changed
2 files changed +25
-6
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ const {
44
44
ArrayPrototypeFill,
45
45
FunctionPrototypeCall,
46
46
JSONParse,
47
+ Number,
47
48
ObjectDefineProperty,
48
49
ObjectGetPrototypeOf,
49
50
ObjectPreventExtensions,
@@ -60,6 +61,9 @@ const {
60
61
deprecate,
61
62
exposeInterface,
62
63
} = require ( 'internal/util' ) ;
64
+ const {
65
+ validateInteger,
66
+ } = require ( 'internal/validators' ) ;
63
67
64
68
setupProcessObject ( ) ;
65
69
@@ -69,6 +73,27 @@ setupBuffer();
69
73
process . domain = null ;
70
74
process . _exiting = false ;
71
75
76
+ {
77
+ let exitCode ;
78
+ ObjectDefineProperty ( process , 'exitCode' , {
79
+ __proto__ : null ,
80
+ get ( ) {
81
+ return exitCode ;
82
+ } ,
83
+ set ( code ) {
84
+ if ( code !== null && code !== undefined ) {
85
+ validateInteger (
86
+ typeof code === 'string' && code !== '' ? Number ( code ) : code ,
87
+ 'code'
88
+ ) ;
89
+ }
90
+ exitCode = code ;
91
+ } ,
92
+ enumerable : true ,
93
+ configurable : true ,
94
+ } ) ;
95
+ }
96
+
72
97
// process.config is serialized config.gypi
73
98
const nativeModule = internalBinding ( 'native_module' ) ;
74
99
Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ const {
13
13
ArrayPrototypeSplice,
14
14
BigUint64Array,
15
15
Float64Array,
16
- Number,
17
16
NumberMAX_SAFE_INTEGER,
18
17
ObjectFreeze,
19
18
ReflectApply,
@@ -44,7 +43,6 @@ const {
44
43
const format = require ( 'internal/util/inspect' ) . format ;
45
44
const {
46
45
validateArray,
47
- validateInteger,
48
46
validateNumber,
49
47
validateObject,
50
48
} = require ( 'internal/validators' ) ;
@@ -184,10 +182,6 @@ function wrapProcessMethods(binding) {
184
182
process . off ( 'exit' , handleProcessExit ) ;
185
183
186
184
if ( code !== null && code !== undefined ) {
187
- validateInteger (
188
- typeof code === 'string' && code !== '' ? Number ( code ) : code ,
189
- 'code' ,
190
- ) ;
191
185
process . exitCode = code ;
192
186
}
193
187
You can’t perform that action at this time.
0 commit comments