diff --git a/crates/project/src/project.rs b/crates/project/src/project.rs index 602c2ecbca..aabca2d9ec 100644 --- a/crates/project/src/project.rs +++ b/crates/project/src/project.rs @@ -10522,7 +10522,7 @@ async fn load_shell_environment(dir: &Path) -> Result> { }); let command = format!( - "cd '{}';{} printf '%s' {marker}; /usr/bin/env -0; exit 0;", + "cd '{}';{} printf '%s' {marker}; /usr/bin/env; exit 0;", dir.display(), additional_command.unwrap_or("") ); @@ -10549,13 +10549,14 @@ async fn load_shell_environment(dir: &Path) -> Result> { let mut parsed_env = HashMap::default(); let env_output = &stdout[env_output_start + marker.len()..]; - for line in env_output.split_terminator('\0') { + for line in env_output.split_terminator('\n') { if let Some(separator_index) = line.find('=') { let key = line[..separator_index].to_string(); let value = line[separator_index + 1..].to_string(); parsed_env.insert(key, value); } } + Ok(parsed_env) } diff --git a/crates/zed/src/main.rs b/crates/zed/src/main.rs index c3a3367c08..b2405903cf 100644 --- a/crates/zed/src/main.rs +++ b/crates/zed/src/main.rs @@ -906,7 +906,7 @@ async fn load_login_shell_environment() -> Result<()> { // We still don't know why `$SHELL -l -i -c '/usr/bin/env -0'` would // do that, but it does, and `exit 0` helps. let shell_cmd = format!( - "{}printf '%s' {marker}; /usr/bin/env -0; exit 0;", + "{}printf '%s' {marker}; /usr/bin/env; exit 0;", shell_cmd_prefix.as_deref().unwrap_or("") ); @@ -923,7 +923,7 @@ async fn load_login_shell_environment() -> Result<()> { if let Some(env_output_start) = stdout.find(marker) { let env_output = &stdout[env_output_start + marker.len()..]; - for line in env_output.split_terminator('\0') { + for line in env_output.split_terminator('\n') { if let Some(separator_index) = line.find('=') { let key = &line[..separator_index]; let value = &line[separator_index + 1..];