Skip to content

Commit

Permalink
Remove tempdir after install
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisduerr committed Jan 20, 2020
1 parent 483ad7c commit 085e4c7
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/cargo/ops/cargo_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,11 @@ fn install_one(
if source_id.is_git() {
if config.target_dir()?.is_none() {
match TempFileBuilder::new().prefix("cargo-install").tempdir() {
Ok(td) => ws.set_target_dir(Filesystem::new(td.path().to_owned())),
Ok(td) => {
let p = td.path().to_owned();
td_opt = Some(td);
ws.set_target_dir(Filesystem::new(p));
}
// If tempfile creation fails, write to cargo cache but clean up afterwards
Err(_) => needs_cleanup = true,
}
Expand Down

0 comments on commit 085e4c7

Please sign in to comment.