Merge branch 'v3' into v3-t29
# Conflicts: # host/Cargo.toml # host/src/harness/mod.rs
This commit is contained in:
@@ -41,6 +41,7 @@ mod bindings {
|
||||
with: {
|
||||
"wasi:io": wasmtime_wasi::p2::bindings::io,
|
||||
"sausage:process/host.child": super::Child,
|
||||
"sausage:process/host.watcher": super::Watcher,
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -55,6 +56,8 @@ pub fn default_script() -> Arc<dyn crate::cred::script::Script> {
|
||||
}
|
||||
pub use cache::configure as configure_cache;
|
||||
mod services;
|
||||
mod watcher;
|
||||
pub use watcher::Watcher;
|
||||
mod stdio;
|
||||
pub use services::supervise;
|
||||
use stdio::Io;
|
||||
@@ -567,7 +570,23 @@ impl Host for State {
|
||||
Ok(self.runtime.kill_pid(pid).map_err(|e| e.to_string()))
|
||||
}
|
||||
}
|
||||
#[async_trait::async_trait]
|
||||
impl wasmtime_wasi::p2::Pollable for Child {
|
||||
async fn ready(&mut self) {
|
||||
while self.code.borrow_and_update().is_none() {
|
||||
if self.code.changed().await.is_err() {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
impl HostChild for State {
|
||||
async fn subscribe(
|
||||
&mut self,
|
||||
child: Resource<Child>,
|
||||
) -> wasmtime::Result<Resource<wasmtime_wasi::p2::DynPollable>> {
|
||||
wasmtime_wasi::p2::subscribe(&mut self.table, child)
|
||||
}
|
||||
async fn pid(&mut self, child: Resource<Child>) -> wasmtime::Result<u32> {
|
||||
Ok(self.table.get(&child)?.pid)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user