Răsfoiți Sursa

fix(desktop): add workaround for nushell

Brendan Allan 1 lună în urmă
părinte
comite
ab705bbc31
1 a modificat fișierele cu 10 adăugiri și 3 ștergeri
  1. 10 3
      packages/desktop/src-tauri/src/cli.rs

+ 10 - 3
packages/desktop/src-tauri/src/cli.rs

@@ -1,5 +1,5 @@
-use tauri::{path::BaseDirectory, AppHandle, Manager};
-use tauri_plugin_shell::{process::Command, ShellExt};
+use tauri::{AppHandle, Manager, path::BaseDirectory};
+use tauri_plugin_shell::{ShellExt, process::Command};
 
 const CLI_INSTALL_DIR: &str = ".opencode/bin";
 const CLI_BINARY_NAME: &str = "opencode";
@@ -164,11 +164,18 @@ pub fn create_command(app: &tauri::AppHandle, args: &str) -> Command {
     return {
         let sidecar = get_sidecar_path(app);
         let shell = get_user_shell();
+
+        let cmd = if shell.ends_with("/nu") {
+            format!("^\"{}\" {}", sidecar.display(), args)
+        } else {
+            format!("\"{}\" {}", sidecar.display(), args)
+        };
+
         app.shell()
             .command(&shell)
             .env("OPENCODE_EXPERIMENTAL_ICON_DISCOVERY", "true")
             .env("OPENCODE_CLIENT", "desktop")
             .env("XDG_STATE_HOME", &state_dir)
-            .args(["-il", "-c", &format!("\"{}\" {}", sidecar.display(), args)])
+            .args(["-il", "-c", &cmd])
     };
 }