File tree Expand file tree Collapse file tree 4 files changed +17
-4
lines changed
library/std/src/sys/process/unix Expand file tree Collapse file tree 4 files changed +17
-4
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,11 @@ impl Process {
152152 Ok ( ( ) )
153153 }
154154
155+ pub fn send_signal ( & self , _signal : i32 ) -> io:: Result < ( ) > {
156+ // Fuchsia doesn't have a direct equivalent for signals
157+ unimplemented ! ( )
158+ }
159+
155160 pub fn wait ( & mut self ) -> io:: Result < ExitStatus > {
156161 let mut proc_info: zx_info_process_t = Default :: default ( ) ;
157162 let mut actual: size_t = 0 ;
Original file line number Diff line number Diff line change @@ -963,7 +963,7 @@ impl Process {
963963 self . pid as u32
964964 }
965965
966- pub fn kill ( & mut self ) -> io:: Result < ( ) > {
966+ pub fn kill ( & self ) -> io:: Result < ( ) > {
967967 self . send_signal ( libc:: SIGKILL )
968968 }
969969
Original file line number Diff line number Diff line change @@ -40,7 +40,11 @@ impl Process {
4040 0
4141 }
4242
43- pub fn kill ( & mut self ) -> io:: Result < ( ) > {
43+ pub fn kill ( & self ) -> io:: Result < ( ) > {
44+ unsupported ( )
45+ }
46+
47+ pub fn send_signal ( & self , _signal : i32 ) -> io:: Result < ( ) > {
4448 unsupported ( )
4549 }
4650
Original file line number Diff line number Diff line change @@ -146,14 +146,18 @@ impl Process {
146146 self . pid as u32
147147 }
148148
149- pub fn kill ( & mut self ) -> io:: Result < ( ) > {
149+ pub fn kill ( & self ) -> io:: Result < ( ) > {
150+ self . send_signal ( libc:: SIGKILL )
151+ }
152+
153+ pub fn send_signal ( & self , signal : i32 ) -> io:: Result < ( ) > {
150154 // If we've already waited on this process then the pid can be recycled
151155 // and used for another process, and we probably shouldn't be killing
152156 // random processes, so return Ok because the process has exited already.
153157 if self . status . is_some ( ) {
154158 Ok ( ( ) )
155159 } else {
156- cvt ( unsafe { libc:: kill ( self . pid , libc :: SIGKILL ) } ) . map ( drop)
160+ cvt ( unsafe { libc:: kill ( self . pid , signal ) } ) . map ( drop)
157161 }
158162 }
159163
You can’t perform that action at this time.
0 commit comments