fix(build): compile the sleep guard on Android and the other no-op Unixes

The release-candidate android-arm64 build on d5cfae1 failed with
`function spawn is never used`: Android is Unix but neither macOS nor
Linux, so `start_inhibitor` is the no-op arm and nothing calls `spawn`,
which `-D warnings` rejects. The helper and the `Command`/`Stdio`
imports now carry the same macOS/Linux gate as their only callers;
`Child` stays Unix-wide for the field and the Drop. Present on main
since 919d602 (2026-09-19); the last green candidate run predates it.

Validation: `cargo fmt --all -- --check` clean; Linux compilation is
unchanged. Judged by re-dispatching release-candidate.yml on this head.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
Claude-Session: https://claude.ai/code/session_0134iUMxmGuXiG1LzPgfZVnv
This commit is contained in:
Claude committed 2026-09-20 14:12:29 +00:00
1 parent d5cfae126b
commit 752bae316e
1 file changed
+6 -2
+6 -2
View File
@@ -28,7 +28,11 @@
//! awake forever, which is worse than the problem this solves.
#[cfg(unix)]
use std::process::{Child, Command, Stdio};
use std::process::Child;
// Only the macOS and Linux inhibitors spawn anything; every other Unix
// (Android, the BSDs, illumos) is a no-op and would see these as dead.
#[cfg(any(target_os = "macos", target_os = "linux"))]
use std::process::{Command, Stdio};
/// An idle-sleep assertion held for as long as this value lives.
pub struct SleepGuard {
@@ -105,7 +109,7 @@ fn start_inhibitor() -> Option<Child> {
None
}
#[cfg(unix)]
#[cfg(any(target_os = "macos", target_os = "linux"))]
fn spawn(program: &str, args: &[&str]) -> Option<Child> {
Command::new(program)
.args(args)