diff --git a/crates/volta-core/src/run/executor.rs b/crates/volta-core/src/run/executor.rs index 175223ed4..5d7517c05 100644 --- a/crates/volta-core/src/run/executor.rs +++ b/crates/volta-core/src/run/executor.rs @@ -288,7 +288,13 @@ impl PackageInstallCommand { .status() .with_context(|| ErrorKind::BinaryExecError)?; - if status.success() { + let was_npm_dry_run = self.installer.get_manager() == PackageManager::Npm + && self + .command + .get_args() + .any(|a| a == "-d" || a == "--dry-run"); + + if status.success() && !was_npm_dry_run { self.installer.complete_install(&image)?; } diff --git a/crates/volta-core/src/run/parser.rs b/crates/volta-core/src/run/parser.rs index 7e5b5c0d5..652646023 100644 --- a/crates/volta-core/src/run/parser.rs +++ b/crates/volta-core/src/run/parser.rs @@ -316,7 +316,10 @@ impl<'a> InstallArgs<'a> { let command = PackageInstallCommand::new(args, platform, self.manager)?; executors.push(command.into()); } - Ok(internal) => executors.push(InternalInstallCommand::new(internal).into()), + Ok(internal) => { + // TODO: gotta fail here or something? + executors.push(InternalInstallCommand::new(internal).into()) + } } } diff --git a/crates/volta-core/src/tool/package/mod.rs b/crates/volta-core/src/tool/package/mod.rs index c8ae39fc5..258cc309f 100644 --- a/crates/volta-core/src/tool/package/mod.rs +++ b/crates/volta-core/src/tool/package/mod.rs @@ -174,6 +174,10 @@ impl DirectInstall { link_package_to_shared_dir(&name, manager)?; configure::write_config_and_shims(&name, &manifest, image, manager) } + + pub fn get_manager(&self) -> PackageManager { + self.manager + } } /// Helper struct for direct in-place upgrades using `npm update -g` or `yarn global upgrade`