Skip to content

Commit 0a9fa6c

Browse files
committed
Don't delete the temporary directory when an error occurs
This makes it really hard to debug what caused the error.
1 parent e28471d commit 0a9fa6c

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

collector/src/execute.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ use std::io::Read;
1616
use std::path::{Path, PathBuf};
1717
use std::process::{self, Command, Stdio};
1818
use std::str;
19+
use std::mem::ManuallyDrop;
1920
use std::time::Duration;
2021
use tempfile::TempDir;
2122
use tokio::runtime::Runtime;
@@ -1230,7 +1231,8 @@ impl Benchmark {
12301231
}
12311232
}
12321233
log::debug!("Benchmark iteration {}/{}", i + 1, iterations);
1233-
let timing_dir = self.make_temp_dir(prep_dir.path())?;
1234+
// Don't delete the directory on error.
1235+
let timing_dir = ManuallyDrop::new(self.make_temp_dir(prep_dir.path())?);
12341236
let cwd = timing_dir.path();
12351237

12361238
// A full non-incremental build.
@@ -1282,6 +1284,7 @@ impl Benchmark {
12821284
}
12831285
}
12841286
}
1287+
drop(ManuallyDrop::into_inner(timing_dir));
12851288
}
12861289
}
12871290

0 commit comments

Comments
 (0)