Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,10 +112,7 @@ pub fn eval<I: io::Read, O: io::Write>(
let media = content_item.render(render_context, &[mime::STAR_STAR])?;

executor::block_on(media.content.try_for_each(|bytes| {
let result = match output.write(&bytes) {
Err(error) => Err(StreamError::from(error)),
Ok(_) => Ok(()),
};
let result = output.write_all(&bytes).map_err(StreamError::from);
async { result }
}))?;

Expand Down Expand Up @@ -152,10 +149,7 @@ pub fn get<O: io::Write>(
let media = content_item.render(render_context, &[accept.unwrap_or(mime::STAR_STAR)])?;

executor::block_on(media.content.try_for_each(|bytes| {
let result = match output.write(&bytes) {
Err(error) => Err(StreamError::from(error)),
Ok(_) => Ok(()),
};
let result = output.write_all(&bytes).map_err(StreamError::from);
async { result }
}))?;

Expand Down
2 changes: 1 addition & 1 deletion src/content/content_item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ mod tests {
assert!(str::from_utf8(non_utf8_bytes).is_err());

let mut file = tempfile().expect("Failed to create temporary file");
file.write(non_utf8_bytes)
file.write_all(non_utf8_bytes)
.expect("Failed to write to temporary file");
let static_content = StaticContentItem {
media_type: MediaType::from_media_range(mime::APPLICATION_OCTET_STREAM).unwrap(),
Expand Down