Skip to content

Commit ced19dc

Browse files
authored
Merge pull request #254 from nyannyacha/fix-sigsegv-deno-runtime-new
fix: `SIGSEGV` has triggered if initializing the main module was failed
2 parents 473aa8b + ff08b2f commit ced19dc

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

crates/base/src/deno_runtime.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -345,15 +345,13 @@ impl DenoRuntime {
345345
op_state.put::<sb_env::EnvVars>(env_vars);
346346
}
347347

348-
let mut js_runtime_mut = scopeguard::guard(&mut js_runtime, |it| unsafe {
349-
it.v8_isolate().exit();
350-
});
351-
352-
let main_module_id = js_runtime_mut
348+
let main_module_id = js_runtime
353349
.load_main_module(&main_module_url, mod_code)
354350
.await?;
355351

356-
drop(js_runtime_mut);
352+
unsafe {
353+
js_runtime.v8_isolate().exit();
354+
}
357355

358356
Ok(Self {
359357
js_runtime,

0 commit comments

Comments
 (0)