From 5ee605995dabd14b768e20ef47405df5930ac661 Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Fri, 29 Jan 2021 15:43:30 -0800 Subject: [PATCH] fix wasi example --- examples/wasi/main.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/wasi/main.rs b/examples/wasi/main.rs index 5769069443..87c59944d5 100644 --- a/examples/wasi/main.rs +++ b/examples/wasi/main.rs @@ -4,8 +4,9 @@ // You can execute this example with `cargo run --example wasi` use anyhow::Result; +use wasi_cap_std_sync::WasiCtxBuilder; use wasmtime::*; -use wasmtime_wasi::{Wasi, WasiCtx}; +use wasmtime_wasi::Wasi; fn main() -> Result<()> { tracing_subscriber::FmtSubscriber::builder() @@ -19,7 +20,13 @@ fn main() -> Result<()> { // 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() + .inherit_args()? + .build()?, + ); wasi.add_to_linker(&mut linker)?; // Instantiate our module with the imports we've created, and run it.