-
Couldn't load subscription status.
- Fork 1.5k
wasip3: Update std{out,err} implementation #11618
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasip3: Update std{out,err} implementation #11618
Conversation
Match the WASIp2 stdio implementation and "lie" about stdio actually being async. Instead of using Tokio's primitives use the `std::io` primitives which will block the current program while the output is produced. This matches WASIp2 semantics and we always have the option of making this more async in the future (or even have it as a runtime flag). This avoids the need to call `poll_flush` in stdio unconditionally in the `wasi:cli` implementation which didn't feel quite right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me, and embedders still have the option of configuring their WasiCtx with stdio streams that use tokio::io::std{out,err}() (or an auto-flushing wrapper around them) to get the previous behavior, if desired.
It's got a shorter command line length limit
* wasip3: Update std{out,err} implementation
Match the WASIp2 stdio implementation and "lie" about stdio actually
being async. Instead of using Tokio's primitives use the `std::io`
primitives which will block the current program while the output is
produced. This matches WASIp2 semantics and we always have the option of
making this more async in the future (or even have it as a runtime
flag). This avoids the need to call `poll_flush` in stdio
unconditionally in the `wasi:cli` implementation which didn't feel quite
right.
* One fewer run for Windows
It's got a shorter command line length limit
* wasip3: Update std{out,err} implementation (#11618)
* wasip3: Update std{out,err} implementation
Match the WASIp2 stdio implementation and "lie" about stdio actually
being async. Instead of using Tokio's primitives use the `std::io`
primitives which will block the current program while the output is
produced. This matches WASIp2 semantics and we always have the option of
making this more async in the future (or even have it as a runtime
flag). This avoids the need to call `poll_flush` in stdio
unconditionally in the `wasi:cli` implementation which didn't feel quite
right.
* One fewer run for Windows
It's got a shorter command line length limit
* wasip3: Refactor file in/out streams (#11619)
* Deduplicate write/append streams
* Deduplicate poll-the-task and spawn-the-task-then-poll
* Explicitly ignore the `finish` flag
* Support store-access in `bindgen!` generated imports (#11628)
* Support store-access in `bindgen!` generated imports
This commit adds support to accessing the store in `bindgen!`-generated
import functions in traits. Since the inception of `bindgen!` this has
never been possible and access to the store requires manually working
with `Linker`, for example. This is not easy to do because it requires
surgically editing code or working around what bindings generation parts
you do want.
The implementation here is a small step away from what
component-model-async has already implemented for async functions.
Effectively it's a small extension of the `*WithStore` traits to also
have synchronous functions with `Access` parameters instead of `async`
functions with an `Accessor` parameter.
This is something we're going to want for the WASIp3 implementation
where I've noticed some resource destructors are going to want access to
the store to close out streams and such and this'll provide the bindings
necessary for that.
Closes #11590
* Update test expectations
* feat(p3): implement `wasi:http` (#11440)
* feat(p3-http): begin implementation
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* feat(p3-http): implement incoming HTTP
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* feat(p3-http): switch to new API
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* feat(p3-http): begin outgoing implementation
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* test(p3-http): test invalid header
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* fix(p3-http): await I/O if future receiver dropped
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
* Re-internalize some fields
Try to keep fields private and use public ctors instead.
* Uncomment `p3_http_outbound_request_content_length` test
It's still semi-failing, but defer that to #11631
* Get tests passing CI again
---------
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Alex Crichton <alex@alexcrichton.com>
* Tune new "much stdout" test for runtime (#11635)
On Pulley platforms this test is taking 40+ minutes in CI. Locally it
took 2 minutes to complete. After this change it should still roughly
test the same thing but takes less than 100ms to complete locally.
---------
Signed-off-by: Roman Volosatovs <rvolosatovs@riseup.net>
Co-authored-by: Roman Volosatovs <rvolosatovs@users.noreply.github.com>
* wasip3: Update std{out,err} implementation
Match the WASIp2 stdio implementation and "lie" about stdio actually
being async. Instead of using Tokio's primitives use the `std::io`
primitives which will block the current program while the output is
produced. This matches WASIp2 semantics and we always have the option of
making this more async in the future (or even have it as a runtime
flag). This avoids the need to call `poll_flush` in stdio
unconditionally in the `wasi:cli` implementation which didn't feel quite
right.
* One fewer run for Windows
It's got a shorter command line length limit
Match the WASIp2 stdio implementation and "lie" about stdio actually being async. Instead of using Tokio's primitives use the
std::ioprimitives which will block the current program while the output is produced. This matches WASIp2 semantics and we always have the option of making this more async in the future (or even have it as a runtime flag). This avoids the need to callpoll_flushin stdio unconditionally in thewasi:cliimplementation which didn't feel quite right.