fix wasi example
This commit is contained in:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user