generated from nhcarrigan/template
feat: add windows build woooooo
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 49s
Security Scan and Upload / Security & DefectDojo Upload (pull_request) Successful in 49s
This commit is contained in:
+18
-11
@@ -5,6 +5,9 @@ use std::sync::Arc;
|
||||
use std::thread;
|
||||
use tauri::{AppHandle, Emitter};
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::os::windows::process::CommandExt;
|
||||
|
||||
use crate::types::{CharacterState, ClaudeMessage, ConnectionStatus, ContentBlock, StateChangeEvent, OutputEvent, PermissionPromptEvent};
|
||||
|
||||
const SEARCH_TOOLS: [&str; 5] = ["Read", "Glob", "Grep", "WebSearch", "WebFetch"];
|
||||
@@ -116,24 +119,28 @@ impl WslBridge {
|
||||
cmd.current_dir(working_dir);
|
||||
cmd
|
||||
} else {
|
||||
// Running on Windows - use wsl to call claude
|
||||
// Running on Windows - use wsl with bash login shell to ensure PATH is loaded
|
||||
eprintln!("[DEBUG] Windows path - using wsl");
|
||||
let mut cmd = Command::new("wsl");
|
||||
let mut args = vec![
|
||||
"--cd".to_string(), working_dir.to_string(),
|
||||
"--".to_string(), "claude".to_string(),
|
||||
"--output-format".to_string(), "stream-json".to_string(),
|
||||
"--input-format".to_string(), "stream-json".to_string(),
|
||||
"--verbose".to_string(),
|
||||
];
|
||||
|
||||
// Build the claude command with all arguments
|
||||
let mut claude_cmd = format!(
|
||||
"cd '{}' && claude --output-format stream-json --input-format stream-json --verbose",
|
||||
working_dir
|
||||
);
|
||||
|
||||
// Add allowed tools if any
|
||||
for tool in &allowed_tools {
|
||||
args.push("--allowedTools".to_string());
|
||||
args.push(tool.clone());
|
||||
claude_cmd.push_str(&format!(" --allowedTools '{}'", tool));
|
||||
}
|
||||
|
||||
cmd.args(&args);
|
||||
// Use bash -lc to load login profile (ensures PATH includes claude)
|
||||
cmd.args(["-e", "bash", "-lc", &claude_cmd]);
|
||||
|
||||
// Hide the console window on Windows
|
||||
#[cfg(target_os = "windows")]
|
||||
cmd.creation_flags(0x08000000); // CREATE_NO_WINDOW
|
||||
|
||||
cmd
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user