diff --git a/Cargo.lock b/Cargo.lock index 87a0380..9dcb7c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2212,7 +2212,7 @@ dependencies = [ [[package]] name = "pdf-presenter" -version = "0.1.33" +version = "0.1.34" dependencies = [ "bytemuck", "chrono", diff --git a/Cargo.toml b/Cargo.toml index 46d345f..7d8496c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,7 +4,7 @@ default-members = ["crates/pdf-presenter"] resolver = "3" [workspace.package] -version = "0.1.33" +version = "0.1.34" edition = "2024" license = "MIT" repository = "https://proxy.dandaedre.com/gitea/idle-org/pdf-presenter" diff --git a/crates/pdf-presenter/Cargo.toml b/crates/pdf-presenter/Cargo.toml index 5204902..401d123 100644 --- a/crates/pdf-presenter/Cargo.toml +++ b/crates/pdf-presenter/Cargo.toml @@ -25,9 +25,11 @@ sha2 = "0.10" image = { version = "=0.25.10", default-features = false, features = ["png", "jpeg", "webp", "gif", "bmp", "tiff"] } hayro = "=0.9.0" chrono = "0.4" -keepawake = "=0.6.1" rfd = "=0.15.4" +[target.'cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))'.dependencies] +keepawake = "=0.6.1" + [target.'cfg(unix)'.dependencies] libc = "0.2" diff --git a/crates/pdf-presenter/src/output.rs b/crates/pdf-presenter/src/output.rs index 2a9ef3d..98bf1a9 100644 --- a/crates/pdf-presenter/src/output.rs +++ b/crates/pdf-presenter/src/output.rs @@ -239,6 +239,7 @@ impl Drop for SleepLease { } } pub fn keep_awake() -> Result<(), String> { + #[cfg(any(target_os = "linux", target_os = "windows", target_os = "macos"))] let guard = keepawake::Builder::default() .display(true) .idle(true) @@ -246,6 +247,11 @@ pub fn keep_awake() -> Result<(), String> { .app_name("PDF Presenter") .app_reverse_domain("com.beffroi.pdfpresenter") .create(); + #[cfg(not(any(target_os = "linux", target_os = "windows", target_os = "macos")))] + let guard: Result<(), String> = Err(format!( + "No native sleep-inhibition backend for {}", + std::env::consts::OS + )); #[cfg(target_os = "linux")] let x11 = X11Lease::new(); let status = match &guard { diff --git a/crates/pdf-presenter/tests/native.rs b/crates/pdf-presenter/tests/native.rs index d8106c8..16eb66c 100644 --- a/crates/pdf-presenter/tests/native.rs +++ b/crates/pdf-presenter/tests/native.rs @@ -7,6 +7,7 @@ use std::{ fn run_native(args: &[&str]) -> Output { let mut child = Command::new(env!("CARGO_BIN_EXE_pdf-presenter")) .args(args) + .stdin(Stdio::null()) .stdout(Stdio::piped()) .stderr(Stdio::piped()) .spawn() @@ -562,3 +563,13 @@ fn wayland_browser_parents_to_presenter_before_first_buffer() { "Only the browser is parented" ); } + +#[test] +#[cfg(not(any(target_os = "linux", target_os = "windows", target_os = "macos")))] +fn unsupported_sleep_backend_reports_unavailable_and_exits_on_parent_eof() { + let output = run_native(&["--keep-awake"]); + assert!(output.status.success()); + let status: String = serde_json::from_slice(&output.stdout).unwrap(); + assert!(status.starts_with("Sleep protection unavailable:")); + assert!(status.contains(std::env::consts::OS)); +} diff --git a/docs/changelog.md b/docs/changelog.md index d39b570..7eac895 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -2,6 +2,15 @@ ## Unreleased +### 0.1.34 + +- Restrict keepawake to its supported Linux, Windows and macOS targets so the + FreeBSD CI worker can compile. Other platforms explicitly report sleep protection + as unavailable while retaining the helper status/parent-pipe lifecycle. +- FreeBSD cross-target Clippy passes for all targets/features; native FreeBSD + execution awaits Jenkins. Linux checks/native tests and 13 Python tests pass; + whole-application line coverage is 86.40%. + ### 0.1.33 - Prepare local Linux/Windows x86_64 preview artifacts with rust_realease; verify diff --git a/docs/development/ci.md b/docs/development/ci.md index 128cf26..a1c086a 100644 --- a/docs/development/ci.md +++ b/docs/development/ci.md @@ -57,3 +57,8 @@ the ordinary tests remain headless and explicitly skip native-window smoke. CI u neither the flag nor the virtual-display wrapper. Xvfb tests cannot validate actual monitor routing, compositor policy, macOS Spaces or Windows desktop behavior. The wrapper starts no network listener and alters no physical display. + +The FreeBSD worker compiles without `keepawake`, whose native backends only support +Linux, Windows and macOS. The helper reports sleep protection as unavailable on +FreeBSD and waits for its parent pipe to close as usual. This does not establish +FreeBSD sleep-inhibition support; supported desktop platforms retain their backends.