project: Fix terminal activation scripts failing on Windows for new shells (#37986)
Tasks are still disabled as there seem to be more issues with it Release Notes: - N/A
This commit is contained in:
@@ -19,7 +19,7 @@ use itertools::Itertools;
|
||||
use project::{Fs, Project, ProjectEntryId};
|
||||
use search::{BufferSearchBar, buffer_search::DivRegistrar};
|
||||
use settings::Settings;
|
||||
use task::{RevealStrategy, RevealTarget, ShellBuilder, SpawnInTerminal, TaskId};
|
||||
use task::{RevealStrategy, RevealTarget, SpawnInTerminal, TaskId};
|
||||
use terminal::{
|
||||
Terminal,
|
||||
terminal_settings::{TerminalDockPosition, TerminalSettings},
|
||||
@@ -496,42 +496,10 @@ impl TerminalPanel {
|
||||
|
||||
pub fn spawn_task(
|
||||
&mut self,
|
||||
task: &SpawnInTerminal,
|
||||
task: SpawnInTerminal,
|
||||
window: &mut Window,
|
||||
cx: &mut Context<Self>,
|
||||
) -> Task<Result<WeakEntity<Terminal>>> {
|
||||
let remote_client = self
|
||||
.workspace
|
||||
.update(cx, |workspace, cx| {
|
||||
let project = workspace.project().read(cx);
|
||||
if project.is_via_collab() {
|
||||
Err(anyhow!("cannot spawn tasks as a guest"))
|
||||
} else {
|
||||
Ok(project.remote_client())
|
||||
}
|
||||
})
|
||||
.flatten();
|
||||
|
||||
let remote_client = match remote_client {
|
||||
Ok(remote_client) => remote_client,
|
||||
Err(e) => return Task::ready(Err(e)),
|
||||
};
|
||||
|
||||
let remote_shell = remote_client
|
||||
.as_ref()
|
||||
.and_then(|remote_client| remote_client.read(cx).shell());
|
||||
|
||||
let builder = ShellBuilder::new(remote_shell.as_deref(), &task.shell);
|
||||
let command_label = builder.command_label(&task.command_label);
|
||||
let (command, args) = builder.build(task.command.clone(), &task.args);
|
||||
|
||||
let task = SpawnInTerminal {
|
||||
command_label,
|
||||
command: Some(command),
|
||||
args,
|
||||
..task.clone()
|
||||
};
|
||||
|
||||
if task.allow_concurrent_runs && task.use_new_terminal {
|
||||
return self.spawn_in_new_terminal(task, window, cx);
|
||||
}
|
||||
@@ -1565,7 +1533,7 @@ impl workspace::TerminalProvider for TerminalProvider {
|
||||
window.spawn(cx, async move |cx| {
|
||||
let terminal = terminal_panel
|
||||
.update_in(cx, |terminal_panel, window, cx| {
|
||||
terminal_panel.spawn_task(&task, window, cx)
|
||||
terminal_panel.spawn_task(task, window, cx)
|
||||
})
|
||||
.ok()?
|
||||
.await;
|
||||
|
||||
Reference in New Issue
Block a user