Revert "Bail and signal error when the cwd of a resolved task doesn't exist" (#32866)

Reverts zed-industries/zed#32777
This commit is contained in:
Cole Miller 2025-06-17 10:01:16 -04:00 committed by GitHub
parent b9dc5f9061
commit 6c7bcfe752
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 4 additions and 54 deletions

View file

@ -29,7 +29,6 @@ serde_json.workspace = true
serde_json_lenient.workspace = true
sha2.workspace = true
shellexpand.workspace = true
smol.workspace = true
util.workspace = true
workspace-hack.workspace = true
zed_actions.workspace = true

View file

@ -1,6 +1,5 @@
use anyhow::{Context as _, Result, anyhow, bail};
use anyhow::{Context as _, bail};
use collections::{HashMap, HashSet};
use gpui::{BackgroundExecutor, Task};
use schemars::{JsonSchema, r#gen::SchemaSettings};
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
@ -271,27 +270,6 @@ impl TaskTemplate {
},
})
}
pub fn resolve_task_and_check_cwd(
&self,
id_base: &str,
task_context: &TaskContext,
executor: BackgroundExecutor,
) -> Option<Task<Result<ResolvedTask>>> {
let resolved_task = self.resolve_task(id_base, task_context)?;
let task = executor.spawn(async move {
if let Some(cwd) = resolved_task.resolved.cwd.as_deref() {
match smol::fs::metadata(cwd).await {
Ok(metadata) if metadata.is_dir() => Ok(resolved_task),
Ok(_) => Err(anyhow!("cwd for resolved task is not a directory: {cwd:?}")),
Err(e) => Err(e).context(format!("reading cwd of resolved task: {cwd:?}")),
}
} else {
Ok(resolved_task)
}
});
Some(task)
}
}
const MAX_DISPLAY_VARIABLE_LENGTH: usize = 15;