aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/Process.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-04 08:15:39 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-04 08:15:39 -0800
commita1e62e6bf948d613d5fc2374e7ec0c6c5b67de69 (patch)
treea28e458be2fc1ff07a0b77823cb60fabae86dd46 /src/bun.js/bindings/Process.cpp
parente009be1c5d517a6b51d78cae4567fa559ae644d0 (diff)
downloadbun-a1e62e6bf948d613d5fc2374e7ec0c6c5b67de69.tar.gz
bun-a1e62e6bf948d613d5fc2374e7ec0c6c5b67de69.tar.zst
bun-a1e62e6bf948d613d5fc2374e7ec0c6c5b67de69.zip
Handle exception when creating stdout/stderr
Diffstat (limited to 'src/bun.js/bindings/Process.cpp')
-rw-r--r--src/bun.js/bindings/Process.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/bun.js/bindings/Process.cpp b/src/bun.js/bindings/Process.cpp
index baac2c587..6209f13c5 100644
--- a/src/bun.js/bindings/Process.cpp
+++ b/src/bun.js/bindings/Process.cpp
@@ -84,7 +84,10 @@ JSC_DEFINE_CUSTOM_GETTER(
auto& vm = globalObject->vm();
JSC::JSObject* thisObject = value.toObject(globalObject);
JSC::JSValue stream = constructStdioWriteStream(globalObject, 1);
- thisObject->putDirect(vm, property, stream, 0);
+
+ if (stream)
+ thisObject->putDirect(vm, property, stream, 0);
+
return JSValue::encode(stream);
}
@@ -95,7 +98,10 @@ JSC_DEFINE_CUSTOM_GETTER(
auto& vm = globalObject->vm();
JSC::JSObject* thisObject = value.toObject(globalObject);
JSC::JSValue stream = constructStdioWriteStream(globalObject, 2);
- thisObject->putDirect(vm, property, stream, 0);
+
+ if (stream)
+ thisObject->putDirect(vm, property, stream, 0);
+
return JSValue::encode(stream);
}
@@ -106,7 +112,8 @@ JSC_DEFINE_CUSTOM_SETTER(Process_defaultSetter,
JSC::VM& vm = globalObject->vm();
JSC::JSObject* thisObject = JSC::jsDynamicCast<JSC::JSObject*>(JSValue::decode(thisValue));
- thisObject->putDirect(vm, propertyName, JSValue::decode(value), 0);
+ if (value)
+ thisObject->putDirect(vm, propertyName, JSValue::decode(value), 0);
return true;
}