fix(desktop): add workaround for nushell

This commit is contained in:
Brendan Allan
2026-01-21 20:15:19 +08:00
parent e237f06c96
commit ab705bbc31

View File

@@ -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])
};
}