diff --git a/Cargo.lock b/Cargo.lock index 9c6f008259..fbb40312f5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3216,6 +3216,7 @@ dependencies = [ "smallvec", "target-lexicon", "tempfile", + "wasi-cap-std-sync", "wasmparser", "wasmtime-cache", "wasmtime-environ", diff --git a/crates/wasmtime/Cargo.toml b/crates/wasmtime/Cargo.toml index 52b36464cf..9823f5c74a 100644 --- a/crates/wasmtime/Cargo.toml +++ b/crates/wasmtime/Cargo.toml @@ -37,6 +37,7 @@ winapi = "0.3.7" [dev-dependencies] tempfile = "3.0" wasmtime-wasi = { path = "../wasi" } +wasi-cap-std-sync = { path = "../wasi-common/cap-std-sync" } [badges] maintenance = { status = "actively-developed" } diff --git a/crates/wasmtime/src/lib.rs b/crates/wasmtime/src/lib.rs index 9deb3638d0..269daf1b27 100644 --- a/crates/wasmtime/src/lib.rs +++ b/crates/wasmtime/src/lib.rs @@ -153,7 +153,8 @@ //! ```no_run //! # use anyhow::Result; //! # use wasmtime::*; -//! use wasmtime_wasi::{Wasi, WasiCtx}; +//! use wasmtime_wasi::Wasi; +//! use wasi_cap_std_sync::WasiCtxBuilder; //! //! # fn main() -> Result<()> { //! let store = Store::default(); @@ -162,7 +163,7 @@ //! // Create an instance of `Wasi` which contains a `WasiCtx`. Note that //! // `WasiCtx` provides a number of ways to configure what the target program //! // will have access to. -//! let wasi = Wasi::new(&store, WasiCtx::new(std::env::args())?); +//! let wasi = Wasi::new(&store, WasiCtxBuilder::new().inherit_stdio().build()?); //! wasi.add_to_linker(&mut linker)?; //! //! // Instantiate our module with the imports we've created, and run it.