Skip to content

Commit 9f255e9

Browse files
committed
support more OSes
1 parent 269ee72 commit 9f255e9

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

library/std/src/sys/process/unix/fuchsia.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ impl Process {
152152
Ok(())
153153
}
154154

155+
pub fn send_signal(&mut 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;

library/std/src/sys/process/unix/unsupported.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ impl Process {
4444
unsupported()
4545
}
4646

47+
pub fn send_signal(&mut self, _signal: i32) -> io::Result<()> {
48+
unsupported()
49+
}
50+
4751
pub fn wait(&mut self) -> io::Result<ExitStatus> {
4852
unsupported()
4953
}

library/std/src/sys/process/unix/vxworks.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,13 +147,17 @@ impl Process {
147147
}
148148

149149
pub fn kill(&mut self) -> io::Result<()> {
150+
self.send_signal(libc::SIGKILL)
151+
}
152+
153+
pub fn send_signal(&mut 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

0 commit comments

Comments
 (0)