breadpaper/src/wallpaper.rs
Breadway 50efebe5df Timeout-guard subprocess calls to awww, wal, and bread-theme
wallpaper.rs/pywal.rs/theme.rs each shelled out via a bare
Command::new(...).status() with no timeout — a wedged awww-daemon, pywal
choking on a corrupt/huge image, or a hung bread-theme reload could each
block breadpaper indefinitely. Switched to bread_utils::proc::run (path
dependency for now, see the TODO in Cargo.toml), matching the exact
"anything shelling out to awww" case named in tonight's ecosystem-utils
audit.
2026-07-17 09:52:40 +08:00

15 lines
544 B
Rust

use std::path::Path;
use std::time::Duration;
use anyhow::{Result, bail};
pub fn apply(path: &Path) -> Result<()> {
// Was a bare Command::new("awww").status() with no timeout — a wedged
// awww-daemon (compositor not ready yet, IPC socket stuck) used to be
// able to hang this call indefinitely.
let out = bread_utils::proc::run("awww", &["img", &path.to_string_lossy()], Duration::from_secs(10));
if !out.success {
bail!("awww img failed (is awww-daemon running?): {}", out.stderr.trim());
}
Ok(())
}