Skip to content

Commit 2614c21

Browse files
committed
fix(task): treat all open errors as NotFound
1 parent 37dfa63 commit 2614c21

File tree

4 files changed

+10
-21
lines changed

4 files changed

+10
-21
lines changed

Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/fspy/Cargo.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ ctor = { workspace = true }
4949
test-log = { workspace = true }
5050
tokio = { workspace = true, features = ["rt-multi-thread", "macros", "fs", "io-std"] }
5151

52-
[target.'cfg(all(target_os = "linux", target_arch = "aarch64"))'.dev-dependencies]
53-
fspy_test_bin = { path = "../fspy_test_bin", artifact = "bin", target = "aarch64-unknown-linux-musl" }
52+
# [target.'cfg(all(target_os = "linux", target_arch = "aarch64"))'.dev-dependencies]
53+
# fspy_test_bin = { path = "../fspy_test_bin", artifact = "bin", target = "aarch64-unknown-linux-musl" }
5454

55-
[target.'cfg(all(target_os = "linux", target_arch = "x86_64"))'.dev-dependencies]
56-
fspy_test_bin = { path = "../fspy_test_bin", artifact = "bin", target = "x86_64-unknown-linux-musl" }
55+
# [target.'cfg(all(target_os = "linux", target_arch = "x86_64"))'.dev-dependencies]
56+
# fspy_test_bin = { path = "../fspy_test_bin", artifact = "bin", target = "x86_64-unknown-linux-musl" }
5757

5858
[build-dependencies]
5959
anyhow = { workspace = true }

crates/vite_task/src/error.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
use std::{ffi::OsString, io, path::Path, sync::Arc};
1+
use std::{ffi::OsString, io, path::Path};
22

33
use fspy::error::SpawnError;
44
use petgraph::algo::Cycle;
55
use vite_path::{
6-
AbsolutePath, RelativePathBuf,
6+
RelativePathBuf,
77
absolute::StripPrefixError,
88
relative::{FromPathError, InvalidPathDataError},
99
};
@@ -54,9 +54,6 @@ pub enum Error {
5454
#[error("The path ({path:?}) is not a valid relative path because: {reason}")]
5555
InvalidRelativePath { path: Box<Path>, reason: FromPathError },
5656

57-
#[error("IO error: {err} at {path:?}")]
58-
IoWithPath { err: io::Error, path: Arc<AbsolutePath> },
59-
6057
#[cfg(unix)]
6158
#[error("Unsupported file type: {0:?}")]
6259
UnsupportedFileType(nix::dir::Type),

crates/vite_task/src/fs.rs

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ impl FileSystem for RealFileSystem {
4949

5050
let file = match File::open(std_path) {
5151
Ok(file) => file,
52+
#[allow(unused)]
5253
Err(err) => {
5354
// On Windows, File::open fails specifically for directories with PermissionDenied
5455
#[cfg(windows)]
@@ -59,17 +60,9 @@ impl FileSystem for RealFileSystem {
5960
}
6061
}
6162

62-
return if matches!(
63-
err.kind(),
64-
io::ErrorKind::NotFound |
65-
// A component used as a directory in path is not a directory,
66-
// e.g. "/foo.txt/bar" where "/foo.txt" is a file
67-
io::ErrorKind::NotADirectory
68-
) {
69-
Ok(PathFingerprint::NotFound)
70-
} else {
71-
Err(Error::IoWithPath { err, path: path.clone() })
72-
};
63+
// There are many reasons why opening a file might fail (NotFound, InvalidFilename, NotADirectory, PermissionDenied).
64+
// Consider all of them as NotFound for fingerprinting purposes.
65+
return Ok(PathFingerprint::NotFound);
7366
}
7467
};
7568

0 commit comments

Comments
 (0)