Do not allow [re]running ssh tasks when not connected to the server (#19306)
Release Notes: - N/A
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
use project::TaskSourceKind;
|
||||
use remote::ConnectionState;
|
||||
use task::{ResolvedTask, TaskContext, TaskTemplate};
|
||||
use ui::ViewContext;
|
||||
|
||||
@@ -12,6 +13,19 @@ pub fn schedule_task(
|
||||
omit_history: bool,
|
||||
cx: &mut ViewContext<'_, Workspace>,
|
||||
) {
|
||||
match workspace.project.read(cx).ssh_connection_state(cx) {
|
||||
None | Some(ConnectionState::Connected) => {}
|
||||
Some(
|
||||
ConnectionState::Connecting
|
||||
| ConnectionState::Disconnected
|
||||
| ConnectionState::HeartbeatMissed
|
||||
| ConnectionState::Reconnecting,
|
||||
) => {
|
||||
log::warn!("Cannot schedule tasks when disconnected from a remote host");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if let Some(spawn_in_terminal) =
|
||||
task_to_resolve.resolve_task(&task_source_kind.to_id_base(), task_cx)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user