Skip to content

Commit 23b2ab8

Browse files
committed
fix wasi p3 build and test failures
Signed-off-by: Joel Dice <joel.dice@fermyon.com>
1 parent 5f1b747 commit 23b2ab8

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

crates/wasi/src/p3/cli/host.rs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bytes::BytesMut;
1010
use std::io::Cursor;
1111
use tokio::io::{AsyncRead, AsyncReadExt as _, AsyncWrite, AsyncWriteExt as _};
1212
use wasmtime::component::{
13-
Accessor, AccessorTask, HasData, HostStream, Resource, StreamReader, StreamWriter,
13+
Accessor, AccessorTask, HasData, Resource, StreamReader, StreamWriter, WithAccessor,
1414
};
1515

1616
struct InputTask<T> {
@@ -24,16 +24,13 @@ where
2424
V: AsyncRead + Send + Sync + Unpin + 'static,
2525
{
2626
async fn run(mut self, store: &Accessor<T, U>) -> wasmtime::Result<()> {
27+
let mut tx = WithAccessor::new(store, self.tx);
2728
let mut buf = BytesMut::with_capacity(8192);
28-
while !self.tx.is_closed() {
29+
while !tx.is_closed() {
2930
match self.rx.read_buf(&mut buf).await {
3031
Ok(0) => return Ok(()),
3132
Ok(_) => {
32-
buf = self
33-
.tx
34-
.write_all(store, Cursor::new(buf))
35-
.await
36-
.into_inner();
33+
buf = tx.write_all(store, Cursor::new(buf)).await.into_inner();
3734
buf.clear();
3835
}
3936
Err(_err) => {
@@ -57,9 +54,10 @@ where
5754
V: AsyncWrite + Send + Sync + Unpin + 'static,
5855
{
5956
async fn run(mut self, store: &Accessor<T, U>) -> wasmtime::Result<()> {
57+
let mut rx = WithAccessor::new(store, self.rx);
6058
let mut buf = BytesMut::with_capacity(8192);
61-
while !self.rx.is_closed() {
62-
buf = self.rx.read(store, buf).await;
59+
while !rx.is_closed() {
60+
buf = rx.read(store, buf).await;
6361
match self.tx.write_all(&buf).await {
6462
Ok(()) => {
6563
buf.clear();

0 commit comments

Comments
 (0)