From fae03203730b7dd8d582db320fd8b74519516fa3 Mon Sep 17 00:00:00 2001 From: Young-Flash Date: Wed, 30 Oct 2024 14:08:46 +0800 Subject: [PATCH] feat: support --stack-size flag for v8 --- crates/moonrun/src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/crates/moonrun/src/main.rs b/crates/moonrun/src/main.rs index c30b42d6..07734f57 100644 --- a/crates/moonrun/src/main.rs +++ b/crates/moonrun/src/main.rs @@ -21,6 +21,7 @@ use std::any::Any; use std::io::{self, Write}; use std::path::Path; use std::{cell::Cell, io::Read, path::PathBuf, time::Instant}; +use v8::V8::set_flags_from_string; mod fs_api_temp; mod js; @@ -503,6 +504,9 @@ struct Commandline { #[clap(long)] test_mode: bool, + + #[clap(long)] + stack_size: Option, } fn main() -> anyhow::Result<()> { @@ -519,6 +523,10 @@ fn main() -> anyhow::Result<()> { anyhow::bail!("no such file"); } + if let Some(stack_size) = matches.stack_size { + set_flags_from_string(&format!("--stack-size={}", stack_size)); + } + match file.extension().unwrap().to_str() { Some("wasm") => wasm_mode( file,