fix: open /dev/null on windows

This commit is contained in:
xfy
2025-06-24 19:43:15 +08:00
parent b8dde2c801
commit 00aa21cb79

View File

@ -262,8 +262,13 @@ async fn stream_file(
}
}
#[cfg(windows)]
let null = PathBuf::from("NUL");
#[cfg(not(windows))]
let null = PathBuf::from("/dev/null");
let stream = if not_modified {
let empty = File::open(PathBuf::from("/dev/null"))
let empty = File::open(null)
.await
.with_context(|| "open /dev/null failed")?;
ReaderStream::new(empty)