Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: non blocking cli command check

Louis1c1df56105df
diff --git a/src-tauri/src/core/system/commands.rs b/src-tauri/src/core/system/commands.rs
index 22f8cb647..3ab70a6c4 100644
--- a/src-tauri/src/core/system/commands.rs
+++ b/src-tauri/src/core/system/commands.rs
@@ -341,10 +341,19 @@ pub struct CliInstallStatus {
/// Check if the `jan` CLI binary is accessible on PATH.
#[tauri::command]
-pub fn check_jan_cli_installed() -> CliInstallStatus {
+pub async fn check_jan_cli_installed() -> CliInstallStatus {
let which_cmd = if cfg!(windows) { "where" } else { "which" };
- match std::process::Command::new(which_cmd).arg("jan").output() {
- Ok(out) if out.status.success() => CliInstallStatus {
+ let mut cmd = std::process::Command::new(which_cmd);
+ cmd.arg("jan");
+
+ #[cfg(windows)]
+ {
+ use std::os::windows::process::CommandExt;
+ cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
+ }
+
+ match tokio::task::spawn_blocking(move || cmd.output()).await {
+ Ok(Ok(out)) if out.status.success() => CliInstallStatus {
installed: true,
path: Some(String::from_utf8_lossy(&out.stdout).trim().to_string()),
},