// Note that these functions intentionally do not return the underlying IO error.
// This is done for a few reasons:
//
// - We don't want to see any EPIPE at the top level caused by disconnects in the backend.
// - It seems like it is always clearer for the end user to see a disconnected message.
Note that these functions intentionally do not return the underlying IO error.
This is done for a few reasons.

We don't want to see any EPIPE at the top level caused by disconnects in the backend.
It seems like it is always clearer for the end user to see a disconnected message.
Note that these functions intentionally do not return the underlying IO error . This is done for a few reasons . We don ' t want to see any EPIPE at the top level caused by disconnects in the backend . It seems like it is always clearer for the end user to see a disconnected message .
fn read_from_remote(r: &mut dyn std::io::Read, buf: &mut [u8]) -> Result<(), anyhow::Error> {
    if r.read_exact(buf).is_err() {
        anyhow::bail!("remote disconnected")
    }
    Ok(())
}
fn read_from_remote ( r : & mut dyn std :: io :: Read , buf : & mut [ u8 ] ) -> Result < ( ) , anyhow :: Error > { if r . read_exact ( buf ) . is_err ( ) { anyhow :: bail ! ( " " ) } Ok ( ( ) ) }
Note that these functions intentionally do not return the underlying IO error.
Note that these functions intentionally do not return the underlying IO error .
r
&mut dyn std::io::Read
buf
&mut [u8]