Completely weed out shlex from remote crate

Jakub Konka created

Change summary

Cargo.lock                         | 1 -
crates/remote/Cargo.toml           | 1 -
crates/remote/src/transport/ssh.rs | 5 ++++-
crates/util/src/shell.rs           | 4 ++++
4 files changed, 8 insertions(+), 3 deletions(-)

Detailed changes

Cargo.lock 🔗

@@ -13769,7 +13769,6 @@ dependencies = [
  "serde",
  "serde_json",
  "settings",
- "shlex",
  "smol",
  "tempfile",
  "thiserror 2.0.17",

crates/remote/Cargo.toml 🔗

@@ -34,7 +34,6 @@ rpc = { workspace = true, features = ["gpui"] }
 serde.workspace = true
 serde_json.workspace = true
 settings.workspace = true
-shlex.workspace = true
 smol.workspace = true
 tempfile.workspace = true
 thiserror.workspace = true

crates/remote/src/transport/ssh.rs 🔗

@@ -1077,7 +1077,10 @@ impl SshConnectionOptions {
             "-w",
         ];
 
-        let mut tokens = shlex::split(input).context("invalid input")?.into_iter();
+        let mut tokens = ShellKind::Posix
+            .split(input)
+            .context("invalid input")?
+            .into_iter();
 
         'outer: while let Some(arg) = tokens.next() {
             if ALLOWED_OPTS.contains(&(&arg as &str)) {

crates/util/src/shell.rs 🔗

@@ -435,6 +435,10 @@ impl ShellKind {
         })
     }
 
+    pub fn split(&self, input: &str) -> Option<Vec<String>> {
+        shlex::split(input)
+    }
+
     pub const fn activate_keyword(&self) -> &'static str {
         match self {
             ShellKind::Cmd => "",