mirror of
https://github.com/fluencelabs/wasmer
synced 2025-06-28 08:01:33 +00:00
Merge #968
968: Added invoke option to the command r=syrusakbary a=syrusakbary # Description This PR adds an `--invoke` to the Wasmer CLI <!-- Provide details regarding the change including motivation, links to related issues, and the context of the PR. --> # Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Syrus <me@syrusakbary.com>
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
|
||||
## **[Unreleased]**
|
||||
|
||||
- [#968](https://github.com/wasmerio/wasmer/pull/968) Added `--invoke` option to the command
|
||||
- [#960](https://github.com/wasmerio/wasmer/pull/960) Fix `runtime-c-api` header files when compiled by clang.
|
||||
- [#925](https://github.com/wasmerio/wasmer/pull/925) Host functions can be closures with a captured environment.
|
||||
- [#917](https://github.com/wasmerio/wasmer/pull/917) Host functions (aka imported functions) may not have `&mut vm::Ctx` as first argument, i.e. the presence of the `&mut vm::Ctx` argument is optional.
|
||||
|
@ -132,6 +132,10 @@ struct Run {
|
||||
)]
|
||||
backend: Backend,
|
||||
|
||||
/// Invoke a specified function
|
||||
#[structopt(long = "invoke", short = "i")]
|
||||
invoke: Option<String>,
|
||||
|
||||
/// Emscripten symbol map
|
||||
#[structopt(long = "em-symbol-map", parse(from_os_str), group = "emscripten")]
|
||||
em_symbol_map: Option<PathBuf>,
|
||||
@ -683,8 +687,12 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
||||
args.push(Value::I32(x));
|
||||
}
|
||||
|
||||
let invoke_fn = match options.invoke.as_ref() {
|
||||
Some(fun) => fun,
|
||||
_ => "main",
|
||||
};
|
||||
instance
|
||||
.dyn_func("main")
|
||||
.dyn_func(&invoke_fn)
|
||||
.map_err(|e| format!("{:?}", e))?
|
||||
.call(&args)
|
||||
.map_err(|e| format!("{:?}", e))?;
|
||||
|
Reference in New Issue
Block a user