Properly pass nested script arguments for tasks (#10776)
Closes https://github.com/zed-industries/zed/discussions/10732#discussion-6524347 introduced by https://github.com/zed-industries/zed/pull/10548 while keeping both Python and Bash run selection capabilities. Also replaced redundant `SpawnTask` struct with `SpawnInTerminal` that has identical fields. Release Notes: - Fixed incorrect task escaping of nested script arguments --------- Co-authored-by: Piotr Osiewicz <piotr@zed.dev>
This commit is contained in:
parent
9247da77a3
commit
13c17267b9
10 changed files with 55 additions and 85 deletions
|
@ -4,9 +4,10 @@ use gpui::{AnyWindowHandle, Context, Entity, Model, ModelContext, WeakModel};
|
|||
use settings::Settings;
|
||||
use smol::channel::bounded;
|
||||
use std::path::{Path, PathBuf};
|
||||
use task::SpawnInTerminal;
|
||||
use terminal::{
|
||||
terminal_settings::{self, Shell, TerminalSettings, VenvSettingsContent},
|
||||
SpawnTask, TaskState, TaskStatus, Terminal, TerminalBuilder,
|
||||
TaskState, TaskStatus, Terminal, TerminalBuilder,
|
||||
};
|
||||
use util::ResultExt;
|
||||
|
||||
|
@ -21,7 +22,7 @@ impl Project {
|
|||
pub fn create_terminal(
|
||||
&mut self,
|
||||
working_directory: Option<PathBuf>,
|
||||
spawn_task: Option<SpawnTask>,
|
||||
spawn_task: Option<SpawnInTerminal>,
|
||||
window: AnyWindowHandle,
|
||||
cx: &mut ModelContext<Self>,
|
||||
) -> anyhow::Result<Model<Terminal>> {
|
||||
|
@ -55,14 +56,7 @@ impl Project {
|
|||
id: spawn_task.id,
|
||||
full_label: spawn_task.full_label,
|
||||
label: spawn_task.label,
|
||||
command_label: spawn_task.args.iter().fold(
|
||||
spawn_task.command.clone(),
|
||||
|mut command_label, new_arg| {
|
||||
command_label.push(' ');
|
||||
command_label.push_str(new_arg);
|
||||
command_label
|
||||
},
|
||||
),
|
||||
command_label: spawn_task.command_label,
|
||||
status: TaskStatus::Running,
|
||||
completion_rx,
|
||||
}),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue