From bbfeb418bd48a7034733777d26d3ea3564f0d400 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Thu, 2 Nov 2023 12:48:22 -0400 Subject: [PATCH] WIP --- modules/terminal/Cargo.toml | 1 - process_lib/src/lib.rs | 6 +++++- src/kernel/mod.rs | 25 ++++--------------------- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/modules/terminal/Cargo.toml b/modules/terminal/Cargo.toml index fe91f049..491485e6 100644 --- a/modules/terminal/Cargo.toml +++ b/modules/terminal/Cargo.toml @@ -17,7 +17,6 @@ cargo-component-bindings = { git = "https://github.com/bytecodealliance/cargo-co serde = {version = "1.0", features = ["derive"] } serde_json = "1.0" wit-bindgen = { version = "0.11.0", default_features = false } -uqbarprocesslib = { path = "../../uqbar-process-lib" } [lib] crate-type = ["cdylib"] diff --git a/process_lib/src/lib.rs b/process_lib/src/lib.rs index 0257b959..9698cff8 100644 --- a/process_lib/src/lib.rs +++ b/process_lib/src/lib.rs @@ -14,7 +14,11 @@ struct Component; impl Guest for Component { fn init(_: Address) { - println!("Don't run this, run the app!"); + print_to_terminal(0, "don't run this!"); + + std::thread::sleep(std::time::Duration::from_millis(3000)); + + set_on_panic(&OnPanic::None); } } diff --git a/src/kernel/mod.rs b/src/kernel/mod.rs index 16a6336b..b7f54586 100644 --- a/src/kernel/mod.rs +++ b/src/kernel/mod.rs @@ -123,27 +123,10 @@ impl UqProcessImports for ProcessWasi { // process management: // - /// todo -> move to kernel logic to enable persistence etc. - async fn set_on_panic(&mut self, _on_panic: wit::OnPanic) -> Result<()> { - unimplemented!(); - // let on_panic = match on_panic { - // wit::OnPanic::None => t::OnPanic::None, - // wit::OnPanic::Restart => t::OnPanic::Restart, - // wit::OnPanic::Requests(reqs) => t::OnPanic::Requests( - // reqs.into_iter() - // .map(|(addr, req, payload)| { - // ( - // de_wit_address(addr), - // de_wit_request(req), - // de_wit_payload(payload), - // ) - // }) - // .collect(), - // ), - // }; - - // self.process.metadata.on_panic = on_panic; - // Ok(()) + /// TODO critical: move to kernel logic to enable persistence of choice made here + async fn set_on_panic(&mut self, on_panic: wit::OnPanic) -> Result<()> { + self.process.metadata.on_panic = de_wit_on_panic(on_panic); + Ok(()) } /// create a message from the *kernel* to the filesystem,