cap-std-sync test runner: read stdin to end before inheriting stdio

This commit is contained in:
Pat Hickey
2021-02-01 14:32:51 -08:00
parent 40e541bfc3
commit b9a3f8694d

View File

@@ -88,6 +88,10 @@ pub fn instantiate_inherit_stdio(
let r = { let r = {
let store = Store::default(); let store = Store::default();
// Tests assume that stdin does not have any bytes available to read. Make sure this is the
// case, regardless of the test environment:
let _ = std::io::stdin().read_to_end().expect("read stdin to end");
// Create our wasi context. // Create our wasi context.
// Additionally register any preopened directories if we have them. // Additionally register any preopened directories if we have them.
let mut builder = WasiCtxBuilder::new(); let mut builder = WasiCtxBuilder::new();