diff --git a/crates/vite_task/src/session/execute/spawn.rs b/crates/vite_task/src/session/execute/spawn.rs index 2f7aaa8e..6cf24019 100644 --- a/crates/vite_task/src/session/execute/spawn.rs +++ b/crates/vite_task/src/session/execute/spawn.rs @@ -174,17 +174,15 @@ where let path_writes = &mut track_result.path_writes; for access in termination.path_accesses.iter() { - let relative_path = access - .path - .strip_path_prefix(workspace_root, |strip_result| { - let Ok(stripped_path) = strip_result else { - return None; - }; - Some(RelativePathBuf::new(stripped_path).map_err(|err| { - anyhow::anyhow!("Invalid relative path '{}': {}", stripped_path.display(), err) - })) - }) - .transpose()?; + let relative_path = access.path.strip_path_prefix(workspace_root, |strip_result| { + let Ok(stripped_path) = strip_result else { + return None; + }; + // On Windows, paths are possible to be still absolute after stripping the workspace root. + // For example: c:\workspace\subdir\c:\workspace\subdir + // Just ignore those accesses. + RelativePathBuf::new(stripped_path).ok() + }); let Some(relative_path) = relative_path else { // Ignore accesses outside the workspace