languages: Fix python activation scripts not being quoted (#37159)

Release Notes:

- N/A
This commit is contained in:
Lukas Wirth
2025-08-29 11:39:38 +00:00
committed by GitHub
parent d13ba0162a
commit 4507f60b8d
2 changed files with 57 additions and 67 deletions
+5 -4
View File
@@ -125,12 +125,13 @@ impl RemoteConnection for SshRemoteConnection {
// shlex will wrap the command in single quotes (''), disabling ~ expansion,
// replace ith with something that works
const TILDE_PREFIX: &'static str = "~/";
if working_dir.starts_with(TILDE_PREFIX) {
let working_dir = if working_dir.starts_with(TILDE_PREFIX) {
let working_dir = working_dir.trim_start_matches("~").trim_start_matches("/");
write!(&mut script, "cd \"$HOME/{working_dir}\"; ").unwrap();
format!("$HOME/{working_dir}")
} else {
write!(&mut script, "cd \"{working_dir}\"; ").unwrap();
}
working_dir
};
write!(&mut script, "cd \"{working_dir}\"; ",).unwrap();
} else {
write!(&mut script, "cd; ").unwrap();
};