From 2ad7565a6524d71420c3ca048c59075bd45e655a Mon Sep 17 00:00:00 2001 From: Pat Hickey Date: Fri, 29 Jan 2021 15:39:29 -0800 Subject: [PATCH] update linking example --- examples/linking.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/examples/linking.rs b/examples/linking.rs index f46e7a4f89..b7c862e8d9 100644 --- a/examples/linking.rs +++ b/examples/linking.rs @@ -3,8 +3,9 @@ // You can execute this example with `cargo run --example linking` use anyhow::Result; +use wasi_cap_std_sync::WasiCtxBuilder; use wasmtime::*; -use wasmtime_wasi::{Wasi, WasiCtx}; +use wasmtime_wasi::Wasi; fn main() -> Result<()> { let engine = Engine::default(); @@ -13,7 +14,13 @@ fn main() -> Result<()> { // First set up our linker which is going to be linking modules together. We // want our linker to have wasi available, so we set that up here as well. let mut linker = Linker::new(&store); - 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)?; // Load and compile our two modules