Skip to main content

detect_channel

Function detect_channel 

Source
pub fn detect_channel(
    exe: &Path,
    updater_present: bool,
    in_container: bool,
) -> Channel
Expand description

Work out how this binary was installed from the path it runs as. Pure: the executable path, the updater probe and the container check are all injected, so every branch is unit-tested without installing anything.

Package-manager path markers are checked BEFORE the updater probe: a Homebrew or wheel install can still carry the dist updater alongside it, and in that case the package manager owns the file — running the self-updater would leave the manager’s metadata pointing at a binary it no longer controls.