WasiCtx: default to empty/sink stdio files rather than throw

the test harness now uses the empty stdin file. I tested manually that
the sink stdout & stderr files work, but theres no test in tree at the
moment
This commit is contained in:
Pat Hickey
2021-02-05 17:50:20 -08:00
parent e4827ad779
commit e4ce04bab4
2 changed files with 15 additions and 25 deletions

View File

@@ -1,7 +1,7 @@
use anyhow::Context;
use std::path::Path;
use wasi_cap_std_sync::WasiCtxBuilder;
use wasi_common::pipe::{ReadPipe, WritePipe};
use wasi_common::pipe::WritePipe;
use wasmtime::{Linker, Module, Store};
pub fn instantiate(data: &[u8], bin_name: &str, workspace: Option<&Path>) -> anyhow::Result<()> {
@@ -18,7 +18,6 @@ pub fn instantiate(data: &[u8], bin_name: &str, workspace: Option<&Path>) -> any
builder = builder
.arg(bin_name)?
.arg(".")?
.stdin(Box::new(ReadPipe::from(Vec::new())))
.stdout(Box::new(stdout.clone()))
.stderr(Box::new(stderr.clone()));