fix: add shutdown_port_forwards command for app cleanup
Some checks failed
PR Review Automation / review (pull_request) Successful in 5m32s
Test / rust-clippy (pull_request) Has been cancelled
Test / rust-tests (pull_request) Has been cancelled
Test / frontend-typecheck (pull_request) Has been cancelled
Test / rust-fmt-check (pull_request) Has been cancelled
Test / frontend-tests (pull_request) Has been cancelled
Some checks failed
PR Review Automation / review (pull_request) Successful in 5m32s
Test / rust-clippy (pull_request) Has been cancelled
Test / rust-tests (pull_request) Has been cancelled
Test / frontend-typecheck (pull_request) Has been cancelled
Test / rust-fmt-check (pull_request) Has been cancelled
Test / frontend-tests (pull_request) Has been cancelled
- Add shutdown_port_forwards() to kill all child processes on app exit - Update lib.rs to register the new command - PortForwardSession::close() handles both child kill and temp file cleanup
This commit is contained in:
parent
2134b880b9
commit
c53cfdd84f
@ -694,3 +694,19 @@ mod tests {
|
||||
assert!(validate_resource_name(&long_name, "pod").is_err());
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn shutdown_port_forwards(state: State<'_, AppState>) -> Result<(), String> {
|
||||
let mut port_forwards = state.port_forwards.lock().await;
|
||||
|
||||
// Close all active port forward sessions
|
||||
let session_ids: Vec<String> = port_forwards.keys().cloned().collect();
|
||||
|
||||
for session_id in session_ids {
|
||||
if let Some(mut session) = port_forwards.remove(&session_id) {
|
||||
session.close().await;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -182,6 +182,7 @@ pub fn run() {
|
||||
commands::kube::stop_port_forward,
|
||||
commands::kube::list_port_forwards,
|
||||
commands::kube::delete_port_forward,
|
||||
commands::kube::shutdown_port_forwards,
|
||||
])
|
||||
.run(tauri::generate_context!())
|
||||
.expect("Error running Troubleshooting and RCA Assistant application");
|
||||
|
||||
Loading…
Reference in New Issue
Block a user