Make ShellBuilder::new not branch on a remote shell (#39493)

Release Notes:

- Fixed claude code agent login on remotes

Co-authored-by: Max Brunsfeld <max@zed.dev>
Co-authored-by: Cole Miller <cole@zed.dev>
This commit is contained in:
Lukas Wirth
2025-10-03 23:23:09 +02:00
committed by GitHub
co-authored by Max Brunsfeld Cole Miller
parent 4443f61c16
commit 2859cbdba9
10 changed files with 70 additions and 62 deletions
+7 -10
View File
@@ -18,14 +18,11 @@ pub struct ShellBuilder {
impl ShellBuilder {
/// Create a new ShellBuilder as configured.
pub fn new(remote_system_shell: Option<&str>, shell: &Shell) -> Self {
let (program, args) = match remote_system_shell {
Some(program) => (program.to_string(), Vec::new()),
None => match shell {
Shell::System => (get_system_shell(), Vec::new()),
Shell::Program(shell) => (shell.clone(), Vec::new()),
Shell::WithArguments { program, args, .. } => (program.clone(), args.clone()),
},
pub fn new(shell: &Shell) -> Self {
let (program, args) = match shell {
Shell::System => (get_system_shell(), Vec::new()),
Shell::Program(shell) => (shell.clone(), Vec::new()),
Shell::WithArguments { program, args, .. } => (program.clone(), args.clone()),
};
let kind = ShellKind::new(&program);
@@ -123,7 +120,7 @@ mod test {
#[test]
fn test_nu_shell_variable_substitution() {
let shell = Shell::Program("nu".to_owned());
let shell_builder = ShellBuilder::new(None, &shell);
let shell_builder = ShellBuilder::new(&shell);
let (program, args) = shell_builder.build(
Some("echo".into()),
@@ -151,7 +148,7 @@ mod test {
#[test]
fn redirect_stdin_to_dev_null_precedence() {
let shell = Shell::Program("nu".to_owned());
let shell_builder = ShellBuilder::new(None, &shell);
let shell_builder = ShellBuilder::new(&shell);
let (program, args) = shell_builder
.redirect_stdin_to_dev_null()