##// END OF EJS Templates
rust-chg: have attach_io() simply take reference of AsRawFd object...
Yuya Nishihara -
r45233:cb5822e6 default
parent child Browse files
Show More
@@ -21,14 +21,12 b' use crate::procutil;'
21 /// 3. Client sends fds with 1-byte dummy payload in response.
21 /// 3. Client sends fds with 1-byte dummy payload in response.
22 /// 4. Server returns the number of the fds received.
22 /// 4. Server returns the number of the fds received.
23 ///
23 ///
24 /// If the stderr is omitted, it will be redirected to the stdout. This
24 /// The client-side fds may be dropped once duplicated to the server.
25 /// allows us to attach the pager stdin to both stdout and stderr, and
26 /// dispose of the client-side handle once attached.
27 pub async fn attach_io(
25 pub async fn attach_io(
28 proto: &mut Protocol<impl Connection + AsRawFd>,
26 proto: &mut Protocol<impl Connection + AsRawFd>,
29 stdin: impl AsRawFd,
27 stdin: &impl AsRawFd,
30 stdout: impl AsRawFd,
28 stdout: &impl AsRawFd,
31 stderr: Option<impl AsRawFd>,
29 stderr: &impl AsRawFd,
32 ) -> io::Result<()> {
30 ) -> io::Result<()> {
33 // TODO: unindent
31 // TODO: unindent
34 {
32 {
@@ -56,7 +54,7 b' pub async fn attach_io('
56 let sock_fd = proto.as_raw_fd();
54 let sock_fd = proto.as_raw_fd();
57 let ifd = stdin.as_raw_fd();
55 let ifd = stdin.as_raw_fd();
58 let ofd = stdout.as_raw_fd();
56 let ofd = stdout.as_raw_fd();
59 let efd = stderr.as_ref().map_or(ofd, |f| f.as_raw_fd());
57 let efd = stderr.as_raw_fd();
60 procutil::send_raw_fds(sock_fd, &[ifd, ofd, efd])?;
58 procutil::send_raw_fds(sock_fd, &[ifd, ofd, efd])?;
61 }
59 }
62 ChannelMessage::InputRequest(..)
60 ChannelMessage::InputRequest(..)
General Comments 0
You need to be logged in to leave comments. Login now