Skip to content

Commit adece14

Browse files
chriskrychorwjblue
andcommitted
WIP: fixing #1597
Co-authored-by: Rob Jackson <[email protected]>
1 parent cb659e6 commit adece14

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

crates/volta-core/src/run/executor.rs

+7-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,13 @@ impl PackageInstallCommand {
288288
.status()
289289
.with_context(|| ErrorKind::BinaryExecError)?;
290290

291-
if status.success() {
291+
let was_npm_dry_run = self.installer.get_manager() == PackageManager::Npm
292+
&& self
293+
.command
294+
.get_args()
295+
.any(|a| a == "-d" || a == "--dry-run");
296+
297+
if status.success() && !was_npm_dry_run {
292298
self.installer.complete_install(&image)?;
293299
}
294300

crates/volta-core/src/run/parser.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,10 @@ impl<'a> InstallArgs<'a> {
316316
let command = PackageInstallCommand::new(args, platform, self.manager)?;
317317
executors.push(command.into());
318318
}
319-
Ok(internal) => executors.push(InternalInstallCommand::new(internal).into()),
319+
Ok(internal) => {
320+
// TODO: gotta fail here or something?
321+
executors.push(InternalInstallCommand::new(internal).into())
322+
}
320323
}
321324
}
322325

crates/volta-core/src/tool/package/mod.rs

+4
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,10 @@ impl DirectInstall {
174174
link_package_to_shared_dir(&name, manager)?;
175175
configure::write_config_and_shims(&name, &manifest, image, manager)
176176
}
177+
178+
pub fn get_manager(&self) -> PackageManager {
179+
self.manager
180+
}
177181
}
178182

179183
/// Helper struct for direct in-place upgrades using `npm update -g` or `yarn global upgrade`

0 commit comments

Comments
 (0)