Skip to main content

uninstall_with_hook

Function uninstall_with_hook 

Source
pub fn uninstall_with_hook(
    yes: bool,
    before_remove: impl FnOnce() -> Result<()>,
) -> Result<()>
Expand description

Preview the file-removal plan, then restore runtime integration before removing files. The hook runs once, under the installer lock, only with yes and an existing manifest, after file checks but before any planned removal. An error aborts removal and keeps installed files. The hook must not reenter the installer or terminate user sessions; restore only bindings whose exact ownership the runtime can verify.

A preview (yes == false) never invokes the hook. Runtime bindings still need an executable-absence fallback for servers not reachable during this cleanup. Runtime changes are not rolled back if a subsequent filesystem operation fails.