Skip to content

Commit 7a48da6

Browse files
committed
Impl openssh_sftp_client::Writer for ChildStdin
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
1 parent 9e11998 commit 7a48da6

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/changelog.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
use crate::*;
33

44
/// TODO: RENAME THIS INTO THE NEXT VERSION BEFORE RELEASE
5+
///
6+
/// ## Added
7+
/// - Implement [`openssh_sftp_client::Writer`] for `ChildStdin`
8+
/// if feature `openssh-sftp-client` is enabled.
59
#[doc(hidden)]
610
pub mod unreleased {}
711

src/stdio.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,20 @@ impl_try_from_tokio_process_child_for_stdio!(ChildStderr);
128128
#[derive(Debug)]
129129
pub struct ChildStdin(tokio_pipe::PipeWrite);
130130

131+
#[cfg(feature = "openssh-sftp-client")]
132+
impl openssh_sftp_client::Writer for ChildStdin {
133+
const MAX_ATOMIC_WRITE_LEN: usize =
134+
<tokio_pipe::PipeWrite as openssh_sftp_client::Writer>::MAX_ATOMIC_WRITE_LEN;
135+
136+
fn poll_write_vectored_atomic(
137+
&self,
138+
cx: &mut Context<'_>,
139+
bufs: &[io::IoSlice<'_>],
140+
) -> Poll<io::Result<()>> {
141+
self.0.poll_write_vectored_atomic(cx, bufs)
142+
}
143+
}
144+
131145
/// Stdout for the remote child.
132146
#[derive(Debug)]
133147
pub struct ChildStdout(tokio_pipe::PipeRead);

0 commit comments

Comments
 (0)