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 {
152
152
Ok ( ( ) )
153
153
}
154
154
155
+ pub fn send_signal ( & self , _signal : i32 ) -> io:: Result < ( ) > {
156
+ // Fuchsia doesn't have a direct equivalent for signals
157
+ unimplemented ! ( )
158
+ }
159
+
155
160
pub fn wait ( & mut self ) -> io:: Result < ExitStatus > {
156
161
let mut proc_info: zx_info_process_t = Default :: default ( ) ;
157
162
let mut actual: size_t = 0 ;
Original file line number Diff line number Diff line change @@ -963,7 +963,7 @@ impl Process {
963
963
self . pid as u32
964
964
}
965
965
966
- pub fn kill ( & mut self ) -> io:: Result < ( ) > {
966
+ pub fn kill ( & self ) -> io:: Result < ( ) > {
967
967
self . send_signal ( libc:: SIGKILL )
968
968
}
969
969
Original file line number Diff line number Diff line change @@ -40,7 +40,11 @@ impl Process {
40
40
0
41
41
}
42
42
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 < ( ) > {
44
48
unsupported ( )
45
49
}
46
50
Original file line number Diff line number Diff line change @@ -146,14 +146,18 @@ impl Process {
146
146
self . pid as u32
147
147
}
148
148
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 < ( ) > {
150
154
// If we've already waited on this process then the pid can be recycled
151
155
// and used for another process, and we probably shouldn't be killing
152
156
// random processes, so return Ok because the process has exited already.
153
157
if self . status . is_some ( ) {
154
158
Ok ( ( ) )
155
159
} else {
156
- cvt ( unsafe { libc:: kill ( self . pid , libc :: SIGKILL ) } ) . map ( drop)
160
+ cvt ( unsafe { libc:: kill ( self . pid , signal ) } ) . map ( drop)
157
161
}
158
162
}
159
163
You can’t perform that action at this time.
0 commit comments