Don't crash (always?)
This commit is contained in:
parent
7026c6c484
commit
aea41d3d50
2 changed files with 10 additions and 1 deletions
11
src/main.rs
11
src/main.rs
|
|
@ -257,6 +257,10 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: Opt) {
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Here be dragons! This is very much a work in progress, and isn't quite functional
|
||||||
|
// yet. It's being left out of the tests because is slows them down massively (by
|
||||||
|
// recompiling a WASM module for every single test). Stay tuned for more updates!
|
||||||
|
#[cfg(not(test))]
|
||||||
active_threads.push(
|
active_threads.push(
|
||||||
thread::Builder::new()
|
thread::Builder::new()
|
||||||
.name("wasm".to_string())
|
.name("wasm".to_string())
|
||||||
|
|
@ -268,7 +272,11 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: Opt) {
|
||||||
println!("Compiling module...");
|
println!("Compiling module...");
|
||||||
// FIXME: Switch to a higher performance compiler (`Store::default()`) and cache this on disk
|
// FIXME: Switch to a higher performance compiler (`Store::default()`) and cache this on disk
|
||||||
// I could use `(de)serialize_to_file()` for that
|
// I could use `(de)serialize_to_file()` for that
|
||||||
let module = Module::from_file(&store, "target/wasm32-wasi/debug/module.wasm")?;
|
let module = if let Ok(m) = Module::from_file(&store, "strider.wasm") {
|
||||||
|
m
|
||||||
|
} else {
|
||||||
|
return Ok(()) // Just abort this thread quietly if the WASM isn't found
|
||||||
|
};
|
||||||
|
|
||||||
// FIXME: Upstream the `Pipe` struct
|
// FIXME: Upstream the `Pipe` struct
|
||||||
//let output = fluff::Pipe::new();
|
//let output = fluff::Pipe::new();
|
||||||
|
|
@ -343,6 +351,7 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: Opt) {
|
||||||
_ => (),
|
_ => (),
|
||||||
} */
|
} */
|
||||||
}
|
}
|
||||||
|
debug_log_to_file("WASM module loaded and exited cleanly :)".to_string())?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}().unwrap()
|
}().unwrap()
|
||||||
})
|
})
|
||||||
|
|
|
||||||
BIN
strider.wasm
Executable file
BIN
strider.wasm
Executable file
Binary file not shown.
Loading…
Add table
Reference in a new issue