Clean up remote client invocation

Jakub Konka and Lukas Wirth created

Co-authored-by: Lukas Wirth <me@lukaswirth.dev>

Change summary

crates/project/src/terminals.rs | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)

Detailed changes

crates/project/src/terminals.rs 🔗

@@ -168,20 +168,21 @@ impl Project {
                         match remote_client {
                             Some(remote_client) => match activation_script.clone() {
                                 activation_script if !activation_script.is_empty() => {
-                                    let activation_script = activation_script.join("; ");
+                                    let separator = shell_kind.sequential_commands_separator();
+                                    let activation_script =
+                                        activation_script.join(&format!("{separator} "));
                                     let to_run = format_to_run();
-                                    let args = vec![
-                                        "-c".to_owned(),
-                                        format!("{activation_script}; {to_run}"),
-                                    ];
+                                    let shell = remote_client
+                                        .read(cx)
+                                        .shell()
+                                        .unwrap_or_else(get_default_system_shell);
+                                    let arg = format!("{activation_script}{separator} {to_run}");
+                                    let args = shell_kind.args_for_shell(false, arg);
+
+                                    dbg!(&args);
+
                                     create_remote_shell(
-                                        Some((
-                                            &remote_client
-                                                .read(cx)
-                                                .shell()
-                                                .unwrap_or_else(get_default_system_shell),
-                                            &args,
-                                        )),
+                                        Some((&shell, &args)),
                                         env,
                                         path,
                                         remote_client,