Skip to main content

Module detect

Module detect 

Source
Expand description

Local context probes a detector plugin can ask about, through the gated host functions in super::runtime (#156, slice 5).

These are the host-performed reads: the plugin never touches the OS itself — it calls a host function, and the host runs the probe here and returns only a boolean. The matching logic is pure and unit-tested; the sysinfo process read is cross-platform (so it’s exercised on every OS, per the coverage policy) rather than a per-OS FFI shim.

Constants§

MAX_FLAG_BYTES 🔒
Maximum sentinel-flag file we’ll read. A flag is a tiny truthy marker, so anything larger is treated as not-a-flag rather than read into memory.

Functions§

flag_is_truthy
Whether the trimmed, lowercased contents are a recognised truthy token. Pure — the testable core of the file probe.
process_running
Whether any running process’s name matches pattern, using the same token-aware semantics as the app-pause guard (process_match_lower) — so zoom matches Zoom but not zoominfo. Refreshes the process list on each call; callers throttle. Cross-platform via sysinfo, so no per-OS shim.
read_flag
Whether the sentinel file at path exists and holds a truthy value. A missing, oversized, or unreadable file reads as false (no signal). Reuses crate::secure_io::read_capped for the size-bounded read.