Skip to content

Commit 085e4c7

Browse files
committed
Remove tempdir after install
1 parent 483ad7c commit 085e4c7

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/cargo/ops/cargo_install.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,11 @@ fn install_one(
226226
if source_id.is_git() {
227227
if config.target_dir()?.is_none() {
228228
match TempFileBuilder::new().prefix("cargo-install").tempdir() {
229-
Ok(td) => ws.set_target_dir(Filesystem::new(td.path().to_owned())),
229+
Ok(td) => {
230+
let p = td.path().to_owned();
231+
td_opt = Some(td);
232+
ws.set_target_dir(Filesystem::new(p));
233+
}
230234
// If tempfile creation fails, write to cargo cache but clean up afterwards
231235
Err(_) => needs_cleanup = true,
232236
}

0 commit comments

Comments
 (0)