From 5db14d315b0822c6d261c0853a3ea039877fd8a8 Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Tue, 27 May 2025 19:33:16 +0200 Subject: [PATCH] task: Wrap programs in ""s (#31537) This commit effectively re-implements #21981 in task system. commands with spaces cannot be spawned currently, and we don't want to have to deal with shell variables wrapped in "" in DAP locators. Closes #ISSUE Release Notes: - Fixed an issue where tasks with spaces in `command` field could not be spawned. --- crates/languages/src/python.rs | 5 +---- crates/task/src/lib.rs | 1 + 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/languages/src/python.rs b/crates/languages/src/python.rs index e68c43d805edfe33dcfb051df1cc7cb3925476a9..29b376bd986e1bf08de9a0af03f4d90444b54cc0 100644 --- a/crates/languages/src/python.rs +++ b/crates/languages/src/python.rs @@ -382,10 +382,7 @@ impl ContextProvider for PythonContextProvider { toolchains .active_toolchain(worktree_id, Arc::from("".as_ref()), "Python".into(), cx) .await - .map_or_else( - || "python3".to_owned(), - |toolchain| format!("\"{}\"", toolchain.path), - ) + .map_or_else(|| "python3".to_owned(), |toolchain| toolchain.path.into()) } else { String::from("python3") }; diff --git a/crates/task/src/lib.rs b/crates/task/src/lib.rs index a6bf61390906d95dae03c090d1570817b863c129..30605c7d9b6fe8e0dc1ef5c0b28cd1cb70c75564 100644 --- a/crates/task/src/lib.rs +++ b/crates/task/src/lib.rs @@ -384,6 +384,7 @@ impl ShellBuilder { /// Returns the program and arguments to run this task in a shell. pub fn build(mut self, task_command: String, task_args: &Vec) -> (String, Vec) { + let task_command = format!("\"{task_command}\""); let combined_command = task_args .into_iter() .fold(task_command, |mut command, arg| {