summaryrefslogtreecommitdiff
path: root/runtime/ops/process.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-07-15 12:30:25 -0400
committerGitHub <noreply@github.com>2022-07-15 12:30:25 -0400
commit635eed93731c3616cacf53860b9aeeeb8cfe158b (patch)
tree04509d5720189fe12b2021500c461ccea1ddfa8e /runtime/ops/process.rs
parentee0c0586b318fe23908a3b9b4311b26d79c5c8a1 (diff)
chore: fix Windows specific clippy errors (#15212)
Diffstat (limited to 'runtime/ops/process.rs')
-rw-r--r--runtime/ops/process.rs17
1 files changed, 11 insertions, 6 deletions
diff --git a/runtime/ops/process.rs b/runtime/ops/process.rs
index a48cd122d..e5650e305 100644
--- a/runtime/ops/process.rs
+++ b/runtime/ops/process.rs
@@ -318,21 +318,26 @@ pub fn kill(pid: i32, signal: &str) -> Result<(), AnyError> {
} else if pid <= 0 {
Err(type_error("Invalid pid"))
} else {
+ // SAFETY: winapi call
let handle = unsafe { OpenProcess(PROCESS_TERMINATE, FALSE, pid as DWORD) };
if handle.is_null() {
+ // SAFETY: winapi call
let err = match unsafe { GetLastError() } {
ERROR_INVALID_PARAMETER => Error::from(NotFound), // Invalid `pid`.
errno => Error::from_raw_os_error(errno as i32),
};
Err(err.into())
} else {
- let is_terminated = unsafe { TerminateProcess(handle, 1) };
- unsafe { CloseHandle(handle) };
- match is_terminated {
- FALSE => Err(Error::last_os_error().into()),
- TRUE => Ok(()),
- _ => unreachable!(),
+ // SAFETY: winapi calls
+ unsafe {
+ let is_terminated = TerminateProcess(handle, 1);
+ CloseHandle(handle);
+ match is_terminated {
+ FALSE => Err(Error::last_os_error().into()),
+ TRUE => Ok(()),
+ _ => unreachable!(),
+ }
}
}
}