alexcrichton requested wasmtime-wasi-reviewers for a review on PR #11368.
alexcrichton opened PR #11368 from alexcrichton:wasi-cli-refactor to bytecodealliance:main:
This commit is a refactoring of the
wasmtime_wasi::{cli,p2::stdio,p3::cli}modules to share more code. The
generic trait object that represents stdio now has the ability to
acquire either a p2 stream or an async-based stream. The acquisition of
p2 has a default implementation so in the future this can be primarily
Async{Read,Write}-based.Many trait implementations and types and such were all consolidated
together into thewasmtime_wasi::climodule. One-off implementations
in p2/p3 are now shared in one location andWasiCtxBuilderno longer
needs any generics for different stdio streams.Functionally this necessitated the addition of
Async{Read,Write}
implementations for some "base" implementations of stdio primitives.
Implementations were mostly trivial except for a few adapters which were
significantly more complicated, namely theAsync{Read,Write}Stream
adapter which converts a singleAsync{Read,Write}into the stdio of a
component.Finally the stdin implementation for p3 was refactored to avoid use of
tokio::io::stdin()which generally isn't safe to use. It's replaced
with a customAsyncReadusing the worker thread implementation we have
in the crate already.Eventually I hope to remove the distinction between
p{2,3}::WasiCtx
and have these be the same type. This will make it nicer to only have a
singleWasiViewtrait and additionally make it easier to
simultaneously implement all of WASIp{1,2,3}.
alexcrichton requested wasmtime-core-reviewers for a review on PR #11368.
alexcrichton requested pchickey for a review on PR #11368.
alexcrichton commented on PR #11368:
This is currently based on https://github.com/bytecodealliance/wasmtime/pull/11365 and only the final commit is for this PR
alexcrichton updated PR #11368.
alexcrichton updated PR #11368.
alexcrichton updated PR #11368.
alexcrichton edited a comment on PR #11368:
This is currently based on https://github.com/bytecodealliance/wasmtime/pull/11365 and only the final commit is for this PR(EDIT: no longer)
dicej submitted PR review.
alexcrichton merged PR #11368.
Last updated: Dec 06 2025 at 07:03 UTC