diff options
| author | Trevor Gross <t.gross35@gmail.com> | 2025-06-20 02:50:38 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-20 02:50:38 -0400 |
| commit | e381a14b7cb07eb3be4da73a032cb8f4481a05b9 (patch) | |
| tree | e7c8aaf3223ba74aabfdada24aec308ffcf20eab /library/std/src/sys/process/unix/vxworks.rs | |
| parent | c117ebefd23c47fa71252291f7fb597555c74daa (diff) | |
| parent | b3914945ae2d77770c25ed124a8450d82c8f7fe9 (diff) | |
| download | rust-e381a14b7cb07eb3be4da73a032cb8f4481a05b9.tar.gz rust-e381a14b7cb07eb3be4da73a032cb8f4481a05b9.zip | |
Rollup merge of #141990 - Qelxiros:141975-unix_send_signal, r=ChrisDenton,tgross35
Implement send_signal for unix child processes Tracking issue: rust-lang/rust#141975 There are two main differences between my implementation and the Public API section of the tracking issue. ~First, `send_signal` requires a mutable reference, like `Child::kill`.~ Second, `ChildExt` has `Sealed` as a supertrait, bringing it more in line with other extension traits like `CommandExt`. try-job: `dist-various*` try-job: `test-various*`
Diffstat (limited to 'library/std/src/sys/process/unix/vxworks.rs')
| -rw-r--r-- | library/std/src/sys/process/unix/vxworks.rs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/library/std/src/sys/process/unix/vxworks.rs b/library/std/src/sys/process/unix/vxworks.rs index f33b4a375da..51ae8c56bdb 100644 --- a/library/std/src/sys/process/unix/vxworks.rs +++ b/library/std/src/sys/process/unix/vxworks.rs @@ -146,14 +146,18 @@ impl Process { self.pid as u32 } - pub fn kill(&mut self) -> io::Result<()> { + pub fn kill(&self) -> io::Result<()> { + self.send_signal(libc::SIGKILL) + } + + pub fn send_signal(&self, signal: i32) -> io::Result<()> { // If we've already waited on this process then the pid can be recycled // and used for another process, and we probably shouldn't be killing // random processes, so return Ok because the process has exited already. if self.status.is_some() { Ok(()) } else { - cvt(unsafe { libc::kill(self.pid, libc::SIGKILL) }).map(drop) + cvt(unsafe { libc::kill(self.pid, signal) }).map(drop) } } |
