Fix tasks not being stopped on reruns (#29786)
Follow-up of https://github.com/zed-industries/zed/pull/28993 * Tone down tasks' cancellation logging * Fix task terminals' leak, disallowing to fully cancel the task by dropping the terminal off the pane: https://github.com/zed-industries/zed/blob/f619d5f02af100c34e286af294a42a01dcfb238c/crates/terminal_view/src/terminal_panel.rs#L1464-L1471 Release Notes: - Fixed tasks not being stopped on reruns
This commit is contained in:
@@ -1466,9 +1466,22 @@ impl ShellExec {
|
||||
show_command: false,
|
||||
show_rerun: false,
|
||||
};
|
||||
workspace
|
||||
.spawn_in_terminal(spawn_in_terminal, window, cx)
|
||||
.detach_and_log_err(cx);
|
||||
|
||||
let task_status = workspace.spawn_in_terminal(spawn_in_terminal, window, cx);
|
||||
cx.background_spawn(async move {
|
||||
match task_status.await {
|
||||
Some(Ok(status)) => {
|
||||
if status.success() {
|
||||
log::debug!("Vim shell exec succeeded");
|
||||
} else {
|
||||
log::debug!("Vim shell exec failed, code: {:?}", status.code());
|
||||
}
|
||||
}
|
||||
Some(Err(e)) => log::error!("Vim shell exec failed: {e}"),
|
||||
None => log::debug!("Vim shell exec got cancelled"),
|
||||
}
|
||||
})
|
||||
.detach();
|
||||
});
|
||||
return;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user