aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBrooks J Rady <b.j.rady@gmail.com>2020-11-25 21:18:13 +0000
committerBrooks J Rady <b.j.rady@gmail.com>2020-11-25 21:18:13 +0000
commitaea41d3d50f08ecc06cee1b36dd67bf019579255 (patch)
tree4e460c8b011beed549ebbcddc3952bb9648426ba /src
parentDon't crash (sometimes) (diff)
downloadsl0ppij-aea41d3d50f08ecc06cee1b36dd67bf019579255.tar.gz
sl0ppij-aea41d3d50f08ecc06cee1b36dd67bf019579255.tar.xz
sl0ppij-aea41d3d50f08ecc06cee1b36dd67bf019579255.zip
Don't crash (always?)
Diffstat (limited to 'src')
-rw-r--r--src/main.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index a7cac65f..cf175779 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -257,6 +257,10 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: Opt) {
.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(
thread::Builder::new()
.name("wasm".to_string())
@@ -268,7 +272,11 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: Opt) {
println!("Compiling module...");
// FIXME: Switch to a higher performance compiler (`Store::default()`) and cache this on disk
// 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
//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(())
}().unwrap()
})