Add basic PyEnv and pixi support for python environments (#37156)

cc https://github.com/zed-industries/zed/issues/29807

Release Notes:

- Fixed terminals and tasks not respecting python pyenv and pixi
environments
This commit is contained in:
Lukas Wirth
2025-08-29 10:19:27 +00:00
committed by GitHub
parent 52da72d80a
commit 7403a4ba17
8 changed files with 155 additions and 100 deletions
+2 -10
View File
@@ -30,10 +30,7 @@ use std::{
time::Instant,
};
use tempfile::TempDir;
use util::{
get_default_system_shell,
paths::{PathStyle, RemotePathBuf},
};
use util::paths::{PathStyle, RemotePathBuf};
pub(crate) struct SshRemoteConnection {
socket: SshSocket,
@@ -116,7 +113,6 @@ impl RemoteConnection for SshRemoteConnection {
input_args: &[String],
input_env: &HashMap<String, String>,
working_dir: Option<String>,
activation_script: Option<String>,
port_forward: Option<(u16, String, u16)>,
) -> Result<CommandTemplate> {
use std::fmt::Write as _;
@@ -138,9 +134,6 @@ impl RemoteConnection for SshRemoteConnection {
} else {
write!(&mut script, "cd; ").unwrap();
};
if let Some(activation_script) = activation_script {
write!(&mut script, " {activation_script};").unwrap();
}
for (k, v) in input_env.iter() {
if let Some((k, v)) = shlex::try_quote(k).ok().zip(shlex::try_quote(v).ok()) {
@@ -162,8 +155,7 @@ impl RemoteConnection for SshRemoteConnection {
write!(&mut script, "exec {shell} -l").unwrap();
};
let sys_shell = get_default_system_shell();
let shell_invocation = format!("{sys_shell} -c {}", shlex::try_quote(&script).unwrap());
let shell_invocation = format!("{shell} -c {}", shlex::try_quote(&script).unwrap());
let mut args = Vec::new();
args.extend(self.socket.ssh_args());