aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/Process.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/bun.js/bindings/Process.cpp')
-rw-r--r--src/bun.js/bindings/Process.cpp14
1 files changed, 2 insertions, 12 deletions
diff --git a/src/bun.js/bindings/Process.cpp b/src/bun.js/bindings/Process.cpp
index 872ec41c3..78f473ec2 100644
--- a/src/bun.js/bindings/Process.cpp
+++ b/src/bun.js/bindings/Process.cpp
@@ -379,14 +379,9 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionExit,
return JSC::JSValue::encode(JSC::JSValue {});
}
- int extiCode32 = arg0.toInt32(globalObject);
+ int extiCode32 = arg0.toInt32(globalObject) % 256;
RETURN_IF_EXCEPTION(throwScope, JSC::JSValue::encode(JSC::JSValue {}));
- if (extiCode32 < 0 || extiCode32 > 127) {
- throwRangeError(globalObject, throwScope, "The \"code\" argument must be an integer between 0 and 127"_s);
- return JSC::JSValue::encode(JSC::JSValue {});
- }
-
exitCode = static_cast<uint8_t>(extiCode32);
} else if (!arg0.isUndefinedOrNull()) {
throwTypeError(globalObject, throwScope, "The \"code\" argument must be an integer"_s);
@@ -1142,14 +1137,9 @@ JSC_DEFINE_HOST_FUNCTION(Process_functionReallyExit, (JSGlobalObject * globalObj
return JSC::JSValue::encode(JSC::JSValue {});
}
- int extiCode32 = arg0.toInt32(globalObject);
+ int extiCode32 = arg0.toInt32(globalObject) % 256;
RETURN_IF_EXCEPTION(throwScope, JSC::JSValue::encode(JSC::JSValue {}));
- if (extiCode32 < 0 || extiCode32 > 127) {
- throwRangeError(globalObject, throwScope, "The \"code\" argument must be an integer between 0 and 127"_s);
- return JSC::JSValue::encode(JSC::JSValue {});
- }
-
exitCode = static_cast<uint8_t>(extiCode32);
} else if (!arg0.isUndefinedOrNull()) {
throwTypeError(globalObject, throwScope, "The \"code\" argument must be an integer"_s);