Skip to content

Commit

Permalink
Add an extra canonicalization step for Windows because why make thing…
Browse files Browse the repository at this point in the history
…s easy when you can make them really annoying
  • Loading branch information
NicholasLYang committed Oct 28, 2024
1 parent 7125885 commit 1a1ccb2
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions crates/turborepo-lib/src/query/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,20 @@ struct TraceResult {
}

impl TraceResult {
fn new(result: turbo_trace::TraceResult, run: Arc<Run>) -> Self {
Self {
fn new(result: turbo_trace::TraceResult, run: Arc<Run>) -> Result<Self, Error> {
Ok(Self {
files: result
.files
.into_iter()
.sorted_by(|a, b| a.0.cmp(&b.0))
.map(|(path, file)| File::new(run.clone(), path).with_ast(file.ast))
.collect(),
.map(|(path, file)| {
#[cfg(windows)]
let path = AbsoluteSystemPathBuf::try_from(dunce::canonicalize(path)?)?;
Ok(File::new(run.clone(), path).with_ast(file.ast))
})
.collect::<Result<_, Error>>()?,
errors: result.errors.into_iter().map(|e| e.into()).collect(),
}
})
}
}

Expand All @@ -162,7 +166,11 @@ impl File {
Ok(self.path.to_string())
}

async fn dependencies(&self, depth: Option<usize>, ts_config: Option<String>) -> TraceResult {
async fn dependencies(
&self,
depth: Option<usize>,
ts_config: Option<String>,
) -> Result<TraceResult, Error> {
let tracer = Tracer::new(
self.run.repo_root().to_owned(),
vec![self.path.clone()],
Expand All @@ -175,7 +183,7 @@ impl File {
TraceResult::new(result, self.run.clone())
}

async fn dependents(&self, ts_config: Option<String>) -> TraceResult {
async fn dependents(&self, ts_config: Option<String>) -> Result<TraceResult, Error> {
let tracer = Tracer::new(
self.run.repo_root().to_owned(),
vec![self.path.clone()],
Expand Down

0 comments on commit 1a1ccb2

Please sign in to comment.