This commit is contained in:
root 2025-07-10 17:34:01 +08:00
parent e865e3c68a
commit 6fdd1b280d
1 changed files with 15 additions and 23 deletions

View File

@ -38,18 +38,11 @@ async fn execute_python_command(_app: tauri::AppHandle, args: &[String]) -> Resu
println!("Working directory: {:?}", project_root); println!("Working directory: {:?}", project_root);
// Try multiple Python commands in order of preference // Try multiple Python commands in order of preference
let python_commands = if cfg!(target_os = "windows") {
vec!["python", "python3", "py"]
} else {
vec!["python3", "python"]
};
let mut child = None; let mut child = None;
let mut last_error = String::new(); let mut last_error = String::new();
for python_cmd in python_commands { let mut cmd = Command::new("python");
println!("Trying Python command: {}", python_cmd);
let mut cmd = Command::new(python_cmd);
cmd.current_dir(&project_root); cmd.current_dir(&project_root);
cmd.args(args); cmd.args(args);
cmd.stdout(std::process::Stdio::piped()); cmd.stdout(std::process::Stdio::piped());
@ -67,7 +60,6 @@ async fn execute_python_command(_app: tauri::AppHandle, args: &[String]) -> Resu
continue; continue;
} }
} }
}
let mut child = child.ok_or_else(|| { let mut child = child.ok_or_else(|| {
format!("Failed to start Python process with any command. Last error: {}", last_error) format!("Failed to start Python process with any command. Last error: {}", last_error)