From bb9515457ea73f032e69169d3a620cfc713f9955 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 3 Apr 2025 11:20:22 -0700 Subject: [PATCH] Fix `StreamWriter::write_all` wrt WebAssembly/component-model#490 Handle the fact that cancellation/0-length writes look the same. --- crates/guest-rust/rt/src/async_support/stream_support.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/guest-rust/rt/src/async_support/stream_support.rs b/crates/guest-rust/rt/src/async_support/stream_support.rs index 2b0fd26dd..7e07344e6 100644 --- a/crates/guest-rust/rt/src/async_support/stream_support.rs +++ b/crates/guest-rust/rt/src/async_support/stream_support.rs @@ -160,6 +160,11 @@ impl StreamWriter { break; } (status, buf) = self.write_buf(buf).await; + + // FIXME(WebAssembly/component-model#490) + if status == StreamResult::Cancelled { + status = StreamResult::Complete(0); + } } // Return back any values that weren't written by shifting them to the