fix: erreurs de compilation — MutexGuard Send, i32/u32→f64, exe_dir Option, warnings
CI / lint (push) Successful in 22s
CI / security (push) Successful in 16s
CI / test (push) Successful in 27s
CI / build (push) Successful in 6s
CI / e2e (push) Failing after 20s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
CI / lint (push) Successful in 22s
CI / security (push) Successful in 16s
CI / test (push) Successful in 27s
CI / build (push) Successful in 6s
CI / e2e (push) Failing after 20s
Desktop Build / build-windows (push) Has been cancelled
Desktop Build / build-linux (push) Has been cancelled
- check_backend_health: dropper MutexGuard avant .await (Send bound) - pos.x/y (i32) → as f64, size.width/height (u32) → as f64 - current_exe: .ok().and_then() au lieu de .and_then() (Option vs Result) - Supprimer state_clone unused + _app pour save_window_state
This commit is contained in:
+14
-17
@@ -272,13 +272,14 @@ fn restart_backend(state: tauri::State<BackendProcess>) -> Result<String, String
|
||||
|
||||
#[tauri::command]
|
||||
async fn check_backend_health(state: tauri::State<'_, BackendProcess>) -> Result<String, String> {
|
||||
// Check if the backend is actually alive
|
||||
let mut child_guard = state.child.lock().map_err(|e| e.to_string())?;
|
||||
let is_alive = match &mut *child_guard {
|
||||
Some(child) => matches!(child.try_wait(), Ok(None)),
|
||||
None => false,
|
||||
// Check if the backend is actually alive (drop guard before await)
|
||||
let is_alive = {
|
||||
let mut child_guard = state.child.lock().map_err(|e| e.to_string())?;
|
||||
match &mut *child_guard {
|
||||
Some(child) => matches!(child.try_wait(), Ok(None)),
|
||||
None => false,
|
||||
}
|
||||
};
|
||||
drop(child_guard);
|
||||
|
||||
if !is_alive {
|
||||
return Ok("dead".to_string());
|
||||
@@ -293,7 +294,7 @@ async fn check_backend_health(state: tauri::State<'_, BackendProcess>) -> Result
|
||||
|
||||
#[tauri::command]
|
||||
fn save_window_state(
|
||||
app: tauri::AppHandle,
|
||||
_app: tauri::AppHandle,
|
||||
x: f64,
|
||||
y: f64,
|
||||
width: f64,
|
||||
@@ -335,8 +336,9 @@ fn main() {
|
||||
|
||||
// Resolve exe directory
|
||||
let exe_dir = std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|p| p.parent().map(|p| p.to_path_buf()))
|
||||
.unwrap_or_else(|_| PathBuf::from("."));
|
||||
.unwrap_or_else(|| PathBuf::from("."));
|
||||
info!("Exe dir: {}", exe_dir.display());
|
||||
|
||||
// Load config for window state
|
||||
@@ -405,11 +407,6 @@ fn main() {
|
||||
|
||||
// Wait for backend health check (non-blocking)
|
||||
let handle = app.handle().clone();
|
||||
let state = app.state::<BackendProcess>();
|
||||
let state_clone = state.inner().clone();
|
||||
// We can't clone state, so we pass the child mutex guard idea
|
||||
// Instead, we just do the initial health check inline
|
||||
|
||||
tauri::async_runtime::spawn(async move {
|
||||
match wait_for_backend().await {
|
||||
Ok(()) => {
|
||||
@@ -482,10 +479,10 @@ fn main() {
|
||||
if let Ok(pos) = window.outer_position() {
|
||||
if let Ok(size) = window.outer_size() {
|
||||
let mut config = load_config();
|
||||
config.window_x = Some(pos.x);
|
||||
config.window_y = Some(pos.y);
|
||||
config.window_width = Some(size.width);
|
||||
config.window_height = Some(size.height);
|
||||
config.window_x = Some(pos.x as f64);
|
||||
config.window_y = Some(pos.y as f64);
|
||||
config.window_width = Some(size.width as f64);
|
||||
config.window_height = Some(size.height as f64);
|
||||
save_config(&config);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user