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

@ -1461,27 +1461,10 @@ impl workspace::TerminalProvider for TerminalProvider {
&self,
task: SpawnInTerminal,
window: &mut Window,
cx: &mut Context<Workspace>,
cx: &mut App,
) -> Task<Option<Result<ExitStatus>>> {
let terminal_panel = self.0.clone();
let workspace = cx.weak_entity();
window.spawn(cx, async move |cx| {
if let Some(cwd) = task.cwd.as_deref() {
let result = match smol::fs::metadata(cwd).await {
Ok(metadata) if metadata.is_dir() => Ok(()),
Ok(_) => Err(anyhow!("cwd for resolved task is not a directory: {cwd:?}")),
Err(e) => Err(e).context(format!("reading cwd of resolved task: {cwd:?}")),
};
if let Err(e) = result {
workspace
.update(cx, |workspace, cx| {
workspace.show_error(&e, cx);
})
.ok();
return None;
}
}
let terminal = terminal_panel
.update_in(cx, |terminal_panel, window, cx| {
terminal_panel.spawn_task(&task, window, cx)