diff --git a/crates/util/src/shell_env.rs b/crates/util/src/shell_env.rs index ba9e77cb81086e810af8d17c7f17f2b77f5392d9..e298530ac3cca3dd67f20609b1c3b7cc95fe4838 100644 --- a/crates/util/src/shell_env.rs +++ b/crates/util/src/shell_env.rs @@ -73,13 +73,27 @@ async fn capture_unix( command.arg("-l"); } } + + match shell_kind { + // Nushell does not allow non-interactive login shells. + // Instead of doing "-l -i -c ''" + // use "-l -e '; exit'" instead + ShellKind::Nushell => command.arg("-e"), + _ => command.args(["-i", "-c"]), + }; + // cd into the directory, triggering directory specific side-effects (asdf, direnv, etc) command_string.push_str(&format!("cd '{}';", directory.display())); if let Some(prefix) = shell_kind.command_prefix() { command_string.push(prefix); } command_string.push_str(&format!("{} --printenv {}", zed_path, redir)); - command.args(["-i", "-c", &command_string]); + + if let ShellKind::Nushell = shell_kind { + command_string.push_str("; exit"); + } + + command.arg(&command_string); super::set_pre_exec_to_start_new_session(&mut command);