mirror of
https://github.com/NeuralNomadsAI/CodeNomad.git
synced 2026-08-31 01:44:52 +00:00
fix(tauri): serialize CLI restart with shutdown
Run the complete CLI stop/start restart while holding the shutdown coordinator authority. Shutdown now waits for an admitted restart, while restart requests arriving after shutdown begins fail without spawning another process. This prevents final cleanup from racing a restart that could recreate the embedded server immediately before application exit. Validated with cargo fmt and all 121 Tauri tests on Windows.
This commit is contained in:
parent
4c702cdf36
commit
7a8d06d32b
1 changed files with 10 additions and 7 deletions
|
|
@ -390,13 +390,16 @@ fn cli_restart(
|
|||
state: tauri::State<AppState>,
|
||||
) -> Result<CliStatus, String> {
|
||||
require_local_app_window(&window, &state)?;
|
||||
let dev_mode = is_dev_mode();
|
||||
state.manager.stop().map_err(|e| e.to_string())?;
|
||||
state
|
||||
.manager
|
||||
.start(app, dev_mode)
|
||||
.map_err(|e| e.to_string())?;
|
||||
Ok(state.manager.status())
|
||||
shutdown::with_navigation_authority(&app, || {
|
||||
let dev_mode = is_dev_mode();
|
||||
state.manager.stop().map_err(|e| e.to_string())?;
|
||||
state
|
||||
.manager
|
||||
.start(app.clone(), dev_mode)
|
||||
.map_err(|e| e.to_string())?;
|
||||
Ok(state.manager.status())
|
||||
})
|
||||
.unwrap_or_else(|| Err("Application shutdown is in progress".to_string()))
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue