Skip to content

Commit

Permalink
WIP: fixing #1597
Browse files Browse the repository at this point in the history
  • Loading branch information
chriskrycho committed Dec 21, 2023
1 parent 370f7a0 commit b978809
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
8 changes: 7 additions & 1 deletion crates/volta-core/src/run/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)?;
}

Expand Down
5 changes: 4 additions & 1 deletion crates/volta-core/src/run/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,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())
}
}
}

Expand Down
4 changes: 4 additions & 0 deletions crates/volta-core/src/tool/package/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down

0 comments on commit b978809

Please sign in to comment.