fix: replace macOS-only libc::__error() with std::io::Error::last_os_error()

pull/2/head
jackwener 2026-04-16 23:35:30 +08:00
parent 3413f6c8f4
commit d8f4c6e87d
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ fn cmd_stop() -> Result<()> {
{ {
let ret = unsafe { libc::kill(pid as libc::pid_t, libc::SIGTERM) }; let ret = unsafe { libc::kill(pid as libc::pid_t, libc::SIGTERM) };
if ret != 0 { if ret != 0 {
let errno = unsafe { *libc::__error() }; let errno = std::io::Error::last_os_error().raw_os_error().unwrap_or(0);
if errno == libc::ESRCH { if errno == libc::ESRCH {
println!("wx-daemon (PID {}) 已不在运行,清理残留文件", pid); println!("wx-daemon (PID {}) 已不在运行,清理残留文件", pid);
} else { } else {