Fix tasks leaked despite workspace window close (#35246)

Closes https://github.com/zed-industries/zed/issues/34932

Release Notes:

- Fixed tasks leaked despite workspace window close
This commit is contained in:
Kirill Bulatov 2025-07-29 01:37:48 +03:00 committed by GitHub
parent 11c7b498b3
commit 798aa50df8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 7 deletions

View file

@ -73,7 +73,7 @@ impl Workspace {
if let Some(terminal_provider) = self.terminal_provider.as_ref() {
let task_status = terminal_provider.spawn(spawn_in_terminal, window, cx);
cx.background_spawn(async move {
let task = cx.background_spawn(async move {
match task_status.await {
Some(Ok(status)) => {
if status.success() {
@ -82,11 +82,11 @@ impl Workspace {
log::debug!("Task spawn failed, code: {:?}", status.code());
}
}
Some(Err(e)) => log::error!("Task spawn failed: {e}"),
Some(Err(e)) => log::error!("Task spawn failed: {e:#}"),
None => log::debug!("Task spawn got cancelled"),
}
})
.detach();
});
self.scheduled_tasks.push(task);
}
}