xtask: the private temp folder builder is mutable only on Unix (#6712)

This commit is contained in:
BFlat authored and GitHub committed 2026-11-09 19:45:13 +08:00
1 parent 9ee213eff7
commit 9f4191336d
1 file changed
+2
+2
View File
@@ -332,6 +332,8 @@ impl PrivateDir {
let nanos = std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).map_or(0, |d| d.subsec_nanos());
for attempt in 0..100u32 {
let path = std::env::temp_dir().join(format!("{prefix}-{}-{nanos}-{attempt}", std::process::id()));
// Only Unix sets a mode on the builder.
#[cfg_attr(not(unix), allow(unused_mut))]
let mut builder = std::fs::DirBuilder::new();
#[cfg(unix)]
std::os::unix::fs::DirBuilderExt::mode(&mut builder, 0o700);