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);
|
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);
|
cmd.current_dir(&project_root);
|
||||||
let mut cmd = Command::new(python_cmd);
|
cmd.args(args);
|
||||||
cmd.current_dir(&project_root);
|
cmd.stdout(std::process::Stdio::piped());
|
||||||
cmd.args(args);
|
cmd.stderr(std::process::Stdio::piped());
|
||||||
cmd.stdout(std::process::Stdio::piped());
|
|
||||||
cmd.stderr(std::process::Stdio::piped());
|
|
||||||
|
|
||||||
match cmd.spawn() {
|
match cmd.spawn() {
|
||||||
Ok(process) => {
|
Ok(process) => {
|
||||||
println!("Successfully started Python process with: {}", python_cmd);
|
println!("Successfully started Python process with: {}", python_cmd);
|
||||||
child = Some(process);
|
child = Some(process);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
last_error = format!("Failed to start {} process: {}", python_cmd, e);
|
last_error = format!("Failed to start {} process: {}", python_cmd, e);
|
||||||
println!("{}", last_error);
|
println!("{}", last_error);
|
||||||
continue;
|
continue;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue