aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/Process.cpp
diff options
context:
space:
mode:
authorGravatar Liz <accs@liz3.net> 2023-10-09 20:47:38 +0200
committerGravatar GitHub <noreply@github.com> 2023-10-09 11:47:38 -0700
commita9e1792607fea89944526ed5478a3a82db2932eb (patch)
tree8a0248b8d1f68ff3f2bd60eaebd825ea4107a080 /src/bun.js/bindings/Process.cpp
parent0965e6ddfd48b2e0e44c2efce7d9fc24115ef63e (diff)
downloadbun-a9e1792607fea89944526ed5478a3a82db2932eb.tar.gz
bun-a9e1792607fea89944526ed5478a3a82db2932eb.tar.zst
bun-a9e1792607fea89944526ed5478a3a82db2932eb.zip
fix: support uint8 exit code range (#6303)
The exit code support is between 0-255 and not only in the signed positive range (0-127). Node.js does not seam to throw on a bigger integer and just wraps around, but throwing a error is a good approach and makes the behaviour more defined. This allows the range to be 0-255 Fixes: https://github.com/oven-sh/bun/issues/6284
Diffstat (limited to 'src/bun.js/bindings/Process.cpp')
-rw-r--r--src/bun.js/bindings/Process.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bun.js/bindings/Process.cpp b/src/bun.js/bindings/Process.cpp
index 1caff9be9..fd194f547 100644
--- a/src/bun.js/bindings/Process.cpp
+++ b/src/bun.js/bindings/Process.cpp
@@ -749,8 +749,8 @@ JSC_DEFINE_CUSTOM_SETTER(setProcessExitCode, (JSC::JSGlobalObject * lexicalGloba
int exitCodeInt = exitCode.toInt32(lexicalGlobalObject);
RETURN_IF_EXCEPTION(throwScope, false);
- if (exitCodeInt < 0 || exitCodeInt > 127) {
- throwRangeError(lexicalGlobalObject, throwScope, "exitCode must be between 0 and 127"_s);
+ if (exitCodeInt < 0 || exitCodeInt > 255) {
+ throwRangeError(lexicalGlobalObject, throwScope, "exitCode must be between 0 and 255"_s);
return false;
}