aboutsummaryrefslogtreecommitdiff
path: root/src/bun.js/bindings/BunJSCModule.cpp
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-13 20:39:49 -0800
committerGravatar Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com> 2022-12-13 20:39:49 -0800
commit47a2548cbfbb977e9b1f0c749bd83d47b4c4596b (patch)
treeb21ee6c8cf8bd0a436475be43bf1e3f1b1b23d1a /src/bun.js/bindings/BunJSCModule.cpp
parent5516adec57d5cee29e636ca43b4155e6279c7e1d (diff)
downloadbun-47a2548cbfbb977e9b1f0c749bd83d47b4c4596b.tar.gz
bun-47a2548cbfbb977e9b1f0c749bd83d47b4c4596b.tar.zst
bun-47a2548cbfbb977e9b1f0c749bd83d47b4c4596b.zip
Fix crash in `startSamplingProfiler`
Diffstat (limited to 'src/bun.js/bindings/BunJSCModule.cpp')
-rw-r--r--src/bun.js/bindings/BunJSCModule.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/bun.js/bindings/BunJSCModule.cpp b/src/bun.js/bindings/BunJSCModule.cpp
index a89bba52a..fd92b817e 100644
--- a/src/bun.js/bindings/BunJSCModule.cpp
+++ b/src/bun.js/bindings/BunJSCModule.cpp
@@ -265,18 +265,16 @@ JSC_DEFINE_HOST_FUNCTION(functionStartSamplingProfiler, (JSC::JSGlobalObject * g
auto scope = DECLARE_THROW_SCOPE(vm);
if (directoryValue.isString()) {
- WTF::String optionString = WTF::String::fromUTF8("samplingProfilerPath=");
auto path = directoryValue.toWTFString(globalObject);
if (!path.isEmpty()) {
StringPrintStream pathOut;
- const char* optionCString = toCString(String(optionString + path)).data();
-
- if (!Bun__mkdirp(globalObject, optionCString)) {
+ auto pathCString = toCString(String(path));
+ if (!Bun__mkdirp(globalObject, pathCString.data())) {
throwVMError(globalObject, scope, createTypeError(globalObject, "directory couldn't be created"_s));
return JSC::JSValue::encode(jsUndefined());
}
- Options::setOption(optionCString);
+ Options::samplingProfilerPath() = pathCString.data();
samplingProfiler.registerForReportAtExit();
}
}