Stream: wasi

Topic: ✔ Changes to wasmtime 14.0.0 WasiCtxBuilder stdout/stderr...


view this post on Zulip Richard Backhouse (Oct 21 2023 at 11:53):

Changes to wasmtime 14.0.0 WasiCtxBuilder stdout/stderr methods

I'm trying to migrate to v14 from v13 and am struggling getting the code I currently have to adopt.

Version 13 allowed me to pass an AsyncWriteStream to the stdout and stderr methods but v14 has changed the type from HostOutputStream to StdoutStream which AsyncWriteStream does not implement.

Does anyone have suggestions on how best to adopt allowing me to continue setting stdout and stderr to my own pathed files ?

Thanks

view this post on Zulip Joel Dice (Oct 21 2023 at 15:46):

Here's what we did in Spin:
https://github.com/fermyon/spin/blob/12becdcc33b6e59bb3aea3dd511f24616a239852/crates/core/src/store.rs#L12-L14
https://github.com/fermyon/spin/blob/12becdcc33b6e59bb3aea3dd511f24616a239852/crates/core/src/store.rs#L445-L459
https://github.com/fermyon/spin/blob/12becdcc33b6e59bb3aea3dd511f24616a239852/crates/core/src/store.rs#L224-L226

view this post on Zulip Richard Backhouse (Oct 22 2023 at 09:21):

Thanks !! That worked great.

view this post on Zulip Notification Bot (Oct 22 2023 at 09:21):

Richard Backhouse has marked this topic as resolved.

view this post on Zulip Joel Dice (Oct 26 2023 at 22:51):

Just a quick note that the MyStdoutStream I linked to above doesn't work for composed components (i.e. components that have two or more subcomponents) since each one will need its own handle to each stdio stream. We just discovered this while experimenting with wasm-compose and will update the code to allow MyStdoutStream::stream to be called more than once.


Last updated: Nov 22 2024 at 16:03 UTC