From 1e49460ac7294da4455c5ec691658f9e38d9ccce Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Wed, 15 Feb 2023 12:01:14 +1100 Subject: [PATCH] Fix use of `StreamReadable`: Ensure no empty `Bytes` (#799) which would cause the `StreamReadable` to return eof even if the underlying stream is still open and has not sent EOF yet. Fixed #777 Signed-off-by: Jiahao XU --- crates/binstalk-downloader/src/download/async_extracter.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/crates/binstalk-downloader/src/download/async_extracter.rs b/crates/binstalk-downloader/src/download/async_extracter.rs index ecb087a56..2c8115cc8 100644 --- a/crates/binstalk-downloader/src/download/async_extracter.rs +++ b/crates/binstalk-downloader/src/download/async_extracter.rs @@ -96,6 +96,10 @@ where try_join( async move { while let Some(bytes) = stream.next().await.transpose()? { + if bytes.is_empty() { + continue; + } + if tx.send(bytes).await.is_err() { // The extract tar returns, which could be that: // - Extraction fails with an error