Skip to main content

install_pinned_cli

Function install_pinned_cli 

Source
pub fn install_pinned_cli(
    paths: &DataPaths,
    req: &NpmInstallRequest,
    on_line: &dyn Fn(&'static str, &str),
) -> Result<InstallOutcome, InstallError>
Expand description

Install req into its install dir, blocking — call it from spawn_blocking or a plain thread. The one install routine for resolvecli and the startup warm-up (warm_used_providers):

  1. Take the cross-instance lock, and hold it until this returns — so npm never outlives the lock (Codex P2 on #3927: a timed-out RPC used to drop its guard while npm kept writing).
  2. A valid install already there (another instance finished while this one waited): reuse it. Otherwise clear leftovers, marker and all.
  3. npm install --prefix <dir> <pkg>@<pin>; every output line goes to on_line(stream, line).
  4. Verify the shim, then publish with COMPLETE_MARKER.