mirror of
https://github.com/roc-lang/roc.git
synced 2025-10-02 08:11:12 +00:00
Exit(0) is success when running wasm executables
This commit is contained in:
parent
3ace5c7660
commit
1d1d71be1d
2 changed files with 36 additions and 19 deletions
|
@ -371,15 +371,22 @@ fn run_with_wasmer(wasm_path: &std::path::Path, args: &[String]) {
|
|||
|
||||
// Then, we get the import object related to our WASI
|
||||
// and attach it to the Wasm instance.
|
||||
let import_object = wasi_env
|
||||
.import_object(&module)
|
||||
.unwrap_or_else(|_| wasmer::imports!());
|
||||
let import_object = wasi_env.import_object(&module).unwrap();
|
||||
|
||||
let instance = Instance::new(&module, &import_object).unwrap();
|
||||
|
||||
let start = instance.exports.get_function("_start").unwrap();
|
||||
|
||||
start.call(&[]).unwrap();
|
||||
use wasmer_wasi::WasiError;
|
||||
match start.call(&[]) {
|
||||
Ok(_) => {}
|
||||
Err(e) => match e.downcast::<WasiError>() {
|
||||
Ok(WasiError::Exit(0)) => {
|
||||
// we run the `_start` function, so exit(0) is expected
|
||||
}
|
||||
other => panic!("Wasmer error: {:?}", other),
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
enum Backend {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue