terminal: Do not auto close shell terminals if they error out (#38182)
Closes https://github.com/zed-industries/zed/issues/38134 This also reduces an annoying level of shell nesting Release Notes: - N/A
This commit is contained in:
@@ -769,13 +769,11 @@ impl RemoteClient {
|
||||
}
|
||||
|
||||
pub fn shell(&self) -> Option<String> {
|
||||
Some(self.state.as_ref()?.remote_connection()?.shell())
|
||||
Some(self.remote_connection()?.shell())
|
||||
}
|
||||
|
||||
pub fn shares_network_interface(&self) -> bool {
|
||||
self.state
|
||||
.as_ref()
|
||||
.and_then(|state| state.remote_connection())
|
||||
self.remote_connection()
|
||||
.map_or(false, |connection| connection.shares_network_interface())
|
||||
}
|
||||
|
||||
@@ -787,12 +785,8 @@ impl RemoteClient {
|
||||
working_dir: Option<String>,
|
||||
port_forward: Option<(u16, String, u16)>,
|
||||
) -> Result<CommandTemplate> {
|
||||
let Some(connection) = self
|
||||
.state
|
||||
.as_ref()
|
||||
.and_then(|state| state.remote_connection())
|
||||
else {
|
||||
return Err(anyhow!("no connection"));
|
||||
let Some(connection) = self.remote_connection() else {
|
||||
return Err(anyhow!("no ssh connection"));
|
||||
};
|
||||
connection.build_command(program, args, env, working_dir, port_forward)
|
||||
}
|
||||
@@ -803,11 +797,7 @@ impl RemoteClient {
|
||||
dest_path: RemotePathBuf,
|
||||
cx: &App,
|
||||
) -> Task<Result<()>> {
|
||||
let Some(connection) = self
|
||||
.state
|
||||
.as_ref()
|
||||
.and_then(|state| state.remote_connection())
|
||||
else {
|
||||
let Some(connection) = self.remote_connection() else {
|
||||
return Task::ready(Err(anyhow!("no ssh connection")));
|
||||
};
|
||||
connection.upload_directory(src_path, dest_path, cx)
|
||||
@@ -916,6 +906,12 @@ impl RemoteClient {
|
||||
.unwrap()
|
||||
.unwrap()
|
||||
}
|
||||
|
||||
fn remote_connection(&self) -> Option<Arc<dyn RemoteConnection>> {
|
||||
self.state
|
||||
.as_ref()
|
||||
.and_then(|state| state.remote_connection())
|
||||
}
|
||||
}
|
||||
|
||||
enum ConnectionPoolEntry {
|
||||
|
||||
Reference in New Issue
Block a user