LLM Wiki is a cross-platform desktop application that turns your documents into an organized, interlinked knowledge base — automatically. Instead of traditional RAG (retrieve-and-answer from scratch every time), the LLM incrementally builds and maintains a persistent wiki from your sources。
TypeScript
fix: pass login shell PATH to spawned codex CLI so its node shebang resolves
simplelife67cfcb05762ed8
diff --git a/src-tauri/src/commands/cli_resolver.rs b/src-tauri/src/commands/cli_resolver.rsindex a848991c..2fad5fbc 100644--- a/src-tauri/src/commands/cli_resolver.rs+++ b/src-tauri/src/commands/cli_resolver.rs@@ -9,6 +9,34 @@ const PATH_MARKER: char = '\x1e';static RESOLVED_COMMANDS: OnceLock<Mutex<HashMap<String, PathBuf>>> = OnceLock::new();+#[cfg(not(windows))]+static RESOLVED_SHELL_PATH: OnceLock<Option<String>> = OnceLock::new();++/// PATH to hand a spawned CLI so its interpreter resolves.+///+/// On macOS a GUI launch (Finder/Dock) inherits launchd's minimal PATH, which+/// omits version-manager dirs (nvm, etc.). Locating the binary already falls+/// back to the login shell PATH; node-shim CLIs like `codex`+/// (`#!/usr/bin/env node`) additionally need that PATH at *run* time so their+/// shebang finds `node`. We prepend the login shell PATH to the inherited one+/// (cached, so the shell is spawned at most once). Returns `None` when there is+/// nothing to add, in which case the child should inherit PATH unchanged.+#[cfg(not(windows))]+pub(crate) fn child_path_env() -> Option<String> {+ let shell_path = RESOLVED_SHELL_PATH+ .get_or_init(|| login_shell_path(LOGIN_SHELL_PATH_TIMEOUT))+ .clone()?;+ match std::env::var("PATH") {+ Ok(current) if !current.is_empty() => Some(format!("{shell_path}:{current}")),+ _ => Some(shell_path),+ }+}++#[cfg(windows)]+pub(crate) fn child_path_env() -> Option<String> {+ None+}+pub(crate) async fn find_cli_command(command: &str,windows_candidates: &[&str],diff --git a/src-tauri/src/commands/codex_cli.rs b/src-tauri/src/commands/codex_cli.rsindex 9bf79523..de8ef2f4 100644--- a/src-tauri/src/commands/codex_cli.rs+++ b/src-tauri/src/commands/codex_cli.rs@@ -19,7 +19,7 @@ use tokio::io::{AsyncBufReadExt, AsyncWriteExt, BufReader};use tokio::process::{Child, Command};use tokio::sync::Mutex;-use super::cli_resolver::find_cli_command;+use super::cli_resolver::{child_path_env, find_cli_command};#[derive(Default)]pub struct CodexCliState {@@ -84,6 +84,12 @@ pub async fn codex_cli_detect() -> Result<DetectResult, String> {let path_str = path.to_string_lossy().to_string();let mut cmd = Command::new(&path);suppress_windows_console(&mut cmd);+ // `codex` is a node shim (`#!/usr/bin/env node`); under a GUI launch the+ // inherited PATH lacks node, so hand it the login shell PATH or its+ // shebang fails with `env: node: No such file or directory`.+ if let Some(path_env) = child_path_env() {+ cmd.env("PATH", path_env);+ }let output = tokio::time::timeout(Duration::from_secs(3), cmd.arg("--version").output()).await;match output {@@ -140,6 +146,11 @@ pub async fn codex_cli_spawn(let codex = find_codex_command().await?;let mut cmd = Command::new(&codex);suppress_windows_console(&mut cmd);+ // See `codex_cli_detect`: the node shim needs the login shell PATH at run+ // time so its shebang resolves `node` under a GUI launch.+ if let Some(path_env) = child_path_env() {+ cmd.env("PATH", path_env);+ }cmd.args(build_codex_cli_args(&model, isolate_local_config));cmd.stdin(Stdio::piped())