fix
This commit is contained in:
parent
e865e3c68a
commit
6fdd1b280d
|
|
@ -38,34 +38,26 @@ async fn execute_python_command(_app: tauri::AppHandle, args: &[String]) -> Resu
|
|||
println!("Working directory: {:?}", project_root);
|
||||
|
||||
// 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 last_error = String::new();
|
||||
|
||||
for python_cmd in python_commands {
|
||||
println!("Trying Python command: {}", python_cmd);
|
||||
let mut cmd = Command::new(python_cmd);
|
||||
cmd.current_dir(&project_root);
|
||||
cmd.args(args);
|
||||
cmd.stdout(std::process::Stdio::piped());
|
||||
cmd.stderr(std::process::Stdio::piped());
|
||||
let mut cmd = Command::new("python");
|
||||
cmd.current_dir(&project_root);
|
||||
cmd.args(args);
|
||||
cmd.stdout(std::process::Stdio::piped());
|
||||
cmd.stderr(std::process::Stdio::piped());
|
||||
|
||||
match cmd.spawn() {
|
||||
Ok(process) => {
|
||||
println!("Successfully started Python process with: {}", python_cmd);
|
||||
child = Some(process);
|
||||
break;
|
||||
}
|
||||
Err(e) => {
|
||||
last_error = format!("Failed to start {} process: {}", python_cmd, e);
|
||||
println!("{}", last_error);
|
||||
continue;
|
||||
}
|
||||
match cmd.spawn() {
|
||||
Ok(process) => {
|
||||
println!("Successfully started Python process with: {}", python_cmd);
|
||||
child = Some(process);
|
||||
break;
|
||||
}
|
||||
Err(e) => {
|
||||
last_error = format!("Failed to start {} process: {}", python_cmd, e);
|
||||
println!("{}", last_error);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue