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:
Lukas Wirth
2025-09-11 12:16:08 +00:00
committed by GitHub
parent 6ae83b4740
commit 4002602a89
7 changed files with 38 additions and 43 deletions
+20 -2
View File
@@ -197,7 +197,7 @@ impl Project {
)?,
},
None => match activation_script.clone() {
#[cfg(not(target_os = "windows"))]
#[cfg(not(windows))]
activation_script if !activation_script.is_empty() => {
let activation_script = activation_script.join("; ");
let to_run = if let Some(command) = spawn_task.command {
@@ -214,7 +214,25 @@ impl Project {
program: shell,
args: vec![
"-c".to_owned(),
format!("{activation_script}; {to_run}",),
// alacritty formats all args into a single string literally without extra quoting before handing it off to powershell
// so we work around this here
if cfg!(windows) {
println!(
"{}",
shlex::try_quote(&format!(
"{activation_script}; {to_run}",
))
.unwrap()
.into_owned()
);
shlex::try_quote(&format!(
"{activation_script}; {to_run}",
))
.unwrap()
.into_owned()
} else {
format!("{activation_script}; {to_run}",)
},
],
title_override: None,
}