When passing None to a loaded module, it causes the module to end up with one argument passed with a "":
let wasi_module = vm
.wasi_module_mut()
.ok_or_else(|| anyhow::Error::msg("Not found wasi module"))
.map_err(|err| ExecutorError::Execution(err.into()))?;
wasi_module.initialize(
None,
Some(envs.iter().map(|s| s as &str).collect()),
None,
);
results in module that gets an arg:
fn main() {
let args: Vec<_> = env::args().collect();
let mut cmd = "daemon";
if !args.is_empty() {
//!! args isn't empy! it is ""
}
See containerd/runwasi#146 (comment) for more info.
It looks like the code here is pushing something onto the args for the module:
|
pub fn init_wasi( |
|
&mut self, |
|
args: Option<Vec<&str>>, |
|
envs: Option<Vec<&str>>, |
|
preopens: Option<Vec<&str>>, |
|
) { |
|
// parse args |
|
let cstr_args: Vec<_> = match args { |
|
Some(args) => args |
|
.iter() |
|
.map(|&x| std::ffi::CString::new(x).unwrap()) |
|
.collect(), |
|
None => vec![], |
|
}; |
When passing None to a loaded module, it causes the module to end up with one argument passed with a
"":results in module that gets an arg:
See containerd/runwasi#146 (comment) for more info.
It looks like the code here is pushing something onto the args for the module:
wasmedge-rust-sdk/crates/wasmedge-sys/src/instance/module.rs
Lines 551 to 564 in 441dfe1