Skip to main content

enrich_current_process_path_cached

Function enrich_current_process_path_cached 

Source
pub fn enrich_current_process_path_cached(
    cache_file: Option<&Path>,
) -> EnrichOutcome
Expand description

Like enrich_current_process_path, but reuses the login-shell PATH captured by an earlier launch when nothing it depends on has changed: the shell, the inherited PATH, and the size and mtime of every shell startup file and /etc/paths{,.d}. On a hit no shell is spawned, which takes the 1-2 s an interactive login shell costs (oh-my-zsh, conda, nvm) off the boot path. A miss spawns the shell as before and writes the cache.

Startup files can source other files (a plugin, nvm alias default) whose changes the fingerprint can’t see, so a hit is only as fresh as the last launch: run refresh_login_path_cache after boot so the next launch picks such a change up.