Skip to main content

spawn_periodic_dir_tighten

Function spawn_periodic_dir_tighten 

Source
pub fn spawn_periodic_dir_tighten(dir: PathBuf, interval: Duration)
Expand description

Spawn a detached background thread that re-runs tighten_existing_files_in_dir(&dir) every interval.

tauri_plugin_log creates rotated log files (entracte.log.1, .log.2, …) via OpenOptions without setting an explicit mode, so on Unix they pick up 0o644 from the process umask — wider than the 0o600 we promise. The startup-only tighten in lib::run misses everything created after boot. This periodic sweep closes that gap without coupling the log plugin to our security helpers.

Returns immediately; the thread runs for the process lifetime. Errors from individual tighten_existing_file calls are swallowed inside the helper (matching the startup path).