test: observe partial downloads through file contents on Windows
This commit is contained in:
1 parent
8998139934
commit
3479a05e63
1 file changed
+5
-1
+5
-1
@@ -234,7 +234,11 @@ async fn cancelled_downloads_preserve_the_destination_and_remove_all_staging_fil
|
|||||||
loop {
|
loop {
|
||||||
if std::fs::read_dir(temp.path()).unwrap().any(|entry| {
|
if std::fs::read_dir(temp.path()).unwrap().any(|entry| {
|
||||||
let entry = entry.unwrap();
|
let entry = entry.unwrap();
|
||||||
entry.path() != destination && entry.metadata().unwrap().len() == 1
|
// Windows directory metadata can lag writes to an open file.
|
||||||
|
entry.path() != destination
|
||||||
|
&& std::fs::File::open(entry.path()).is_ok_and(|mut file| {
|
||||||
|
matches!(std::io::Read::read(&mut file, &mut [0]), Ok(1))
|
||||||
|
})
|
||||||
}) {
|
}) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user