mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-13 06:15:33 +00:00
Merge #858
858: [fix 857] panic when target module don't have exported _start function r=syrusakbary a=pventuzelo # Description Fix #857 * replace `expect` by `map_err` for `loader` * replace `expect` by `map_err` in other part of `wasmer.rs` # Review - [x] Add a short description of the the change to the CHANGELOG.md file Co-authored-by: Patrick Ventuzelo <ventuzelo.patrick@gmail.com> Co-authored-by: Patrick Ventuzelo <9038181+pventuzelo@users.noreply.github.com>
This commit is contained in:
commit
18318c2262
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
## **[Unreleased]**
|
## **[Unreleased]**
|
||||||
|
|
||||||
|
- [#858](https://github.com/wasmerio/wasmer/pull/858) Minor panic fix when wasmer binary with `loader` option run a module without exported `_start` function.
|
||||||
- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI
|
- [#1056](https://github.com/wasmerio/wasmer/pull/1056) Improved `--invoke` args parsing (supporting `i32`, `i64`, `f32` and `f32`) in Wasmer CLI
|
||||||
- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI
|
- [#1054](https://github.com/wasmerio/wasmer/pull/1054) Improve `--invoke` output in Wasmer CLI
|
||||||
- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box<Any + Send> instead of Box<Any>.
|
- [#1053](https://github.com/wasmerio/wasmer/pull/1053) For RuntimeError and breakpoints, use Box<Any + Send> instead of Box<Any>.
|
||||||
|
@ -430,7 +430,7 @@ fn execute_wasi(
|
|||||||
f.read_to_end(&mut out).unwrap();
|
f.read_to_end(&mut out).unwrap();
|
||||||
Some(
|
Some(
|
||||||
wasmer_runtime_core::state::InstanceImage::from_bytes(&out)
|
wasmer_runtime_core::state::InstanceImage::from_bytes(&out)
|
||||||
.expect("failed to decode image"),
|
.map_err(|_| format!("failed to decode image"))?,
|
||||||
)
|
)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@ -751,20 +751,21 @@ fn execute_wasm(options: &Run) -> Result<(), String> {
|
|||||||
args.push(Value::I32(x));
|
args.push(Value::I32(x));
|
||||||
}
|
}
|
||||||
|
|
||||||
let index = instance
|
let index = instance.resolve_func("_start").map_err(|_| {
|
||||||
.resolve_func("_start")
|
format!("The loader requires a _start function to be present in the module")
|
||||||
.expect("The loader requires a _start function to be present in the module");
|
})?;
|
||||||
|
|
||||||
let mut ins: Box<dyn LoadedInstance<Error = String>> = match loader {
|
let mut ins: Box<dyn LoadedInstance<Error = String>> = match loader {
|
||||||
LoaderName::Local => Box::new(
|
LoaderName::Local => Box::new(
|
||||||
instance
|
instance
|
||||||
.load(LocalLoader)
|
.load(LocalLoader)
|
||||||
.expect("Can't use the local loader"),
|
.map_err(|e| format!("Can't use the local loader: {:?}", e))?,
|
||||||
),
|
),
|
||||||
#[cfg(feature = "loader-kernel")]
|
#[cfg(feature = "loader-kernel")]
|
||||||
LoaderName::Kernel => Box::new(
|
LoaderName::Kernel => Box::new(
|
||||||
instance
|
instance
|
||||||
.load(::wasmer_kernel_loader::KernelLoader)
|
.load(::wasmer_kernel_loader::KernelLoader)
|
||||||
.expect("Can't use the kernel loader"),
|
.map_err(|e| format!("Can't use the local loader: {:?}", e))?,
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
println!("{:?}", ins.call(index, &args));
|
println!("{:?}", ins.call(index, &args));
|
||||||
|
Loading…
Reference in New Issue
Block a user