|
Revision tags: dev, v36.0.9, v44.0.1, v43.0.2, v36.0.8, v24.0.8, v44.0.0, v43.0.1, v42.0.2, v36.0.7, v24.0.7, v43.0.0, v42.0.1, v41.0.4, v42.0.0, v40.0.4, v36.0.6, v24.0.6, v41.0.3, v41.0.2, v41.0.1, v36.0.5, v40.0.3, v41.0.0, v36.0.4, v39.0.2, v40.0.2, v40.0.1, v40.0.0, v39.0.1, v39.0.0, v38.0.4, v37.0.3, v36.0.3, v24.0.5, v38.0.3, v38.0.2, v38.0.1, v37.0.2, v37.0.1, v37.0.0, v36.0.2, v36.0.1, v36.0.0 |
|
| #
e6a662b3 |
| 01-Aug-2025 |
Alex Crichton <[email protected]> |
Share stdio implementations in WASIp{2,3} (#11368)
* Share stdio implementations in WASIp{2,3}
This commit is a refactoring of the `wasmtime_wasi::{cli,p2::stdio,p3::cli}` modules to share more co
Share stdio implementations in WASIp{2,3} (#11368)
* Share stdio implementations in WASIp{2,3}
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 the `wasmtime_wasi::cli` module. One-off implementations in p2/p3 are now shared in one location and `WasiCtxBuilder` no 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 the `Async{Read,Write}Stream` adapter which converts a single `Async{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 custom `AsyncRead` using 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 single `WasiView` trait and additionally make it easier to simultaneously implement all of WASIp{1,2,3}.
* Fix build of C API
* Fix build of `wasmtime serve`
show more ...
|