equal
deleted
inserted
replaced
20 type PagerStdin: AsRawFd; |
20 type PagerStdin: AsRawFd; |
21 |
21 |
22 /// Handles pager command request. |
22 /// Handles pager command request. |
23 /// |
23 /// |
24 /// Returns the pipe to be attached to the server if the pager is spawned. |
24 /// Returns the pipe to be attached to the server if the pager is spawned. |
25 async fn spawn_pager(&mut self, spec: &CommandSpec) -> io::Result<Self::PagerStdin>; |
25 async fn spawn_pager( |
|
26 &mut self, |
|
27 spec: &CommandSpec, |
|
28 ) -> io::Result<Self::PagerStdin>; |
26 |
29 |
27 /// Handles system command request. |
30 /// Handles system command request. |
28 /// |
31 /// |
29 /// Returns command exit code (positive) or signal number (negative). |
32 /// Returns command exit code (positive) or signal number (negative). |
30 async fn run_system(&mut self, spec: &CommandSpec) -> io::Result<i32>; |
33 async fn run_system(&mut self, spec: &CommandSpec) -> io::Result<i32>; |
51 |
54 |
52 #[async_trait] |
55 #[async_trait] |
53 impl SystemHandler for ChgUiHandler { |
56 impl SystemHandler for ChgUiHandler { |
54 type PagerStdin = ChildStdin; |
57 type PagerStdin = ChildStdin; |
55 |
58 |
56 async fn spawn_pager(&mut self, spec: &CommandSpec) -> io::Result<Self::PagerStdin> { |
59 async fn spawn_pager( |
57 let mut pager = new_shell_command(&spec).stdin(Stdio::piped()).spawn()?; |
60 &mut self, |
|
61 spec: &CommandSpec, |
|
62 ) -> io::Result<Self::PagerStdin> { |
|
63 let mut pager = |
|
64 new_shell_command(&spec).stdin(Stdio::piped()).spawn()?; |
58 let pin = pager.stdin.take().unwrap(); |
65 let pin = pager.stdin.take().unwrap(); |
59 procutil::set_blocking_fd(pin.as_raw_fd())?; |
66 procutil::set_blocking_fd(pin.as_raw_fd())?; |
60 // TODO: if pager exits, notify the server with SIGPIPE immediately. |
67 // TODO: if pager exits, notify the server with SIGPIPE immediately. |
61 // otherwise the server won't get SIGPIPE if it does not write |
68 // otherwise the server won't get SIGPIPE if it does not write |
62 // anything. (issue5278) |
69 // anything. (issue5278) |