mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-08 17:06:15 -08:00
fix(media): prevent process termination on Windows for close_mpv_process function
This commit is contained in:
1 parent
0bdb06c808
commit
a4eeafe6cb
1 file changed
+2
-11
@@ -125,6 +125,8 @@ pub async fn close_mpv_process<R: Runtime>(
|
||||
process_id: u32,
|
||||
app_handle: tauri::AppHandle<R>,
|
||||
) -> Result<(), String> {
|
||||
#[cfg(windows)]
|
||||
return Err("Process termination is not supported on Windows".to_string());
|
||||
if let Some(process) = MPV_PROCESSES.lock().unwrap().remove(&process_id) {
|
||||
#[cfg(unix)]
|
||||
{
|
||||
@@ -133,17 +135,6 @@ pub async fn close_mpv_process<R: Runtime>(
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
{
|
||||
unsafe {
|
||||
let handle = OpenProcess(PROCESS_TERMINATE, 0, process_id);
|
||||
if !handle.is_null() {
|
||||
TerminateProcess(handle, 1);
|
||||
CloseHandle(handle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Updated event emission
|
||||
app_handle
|
||||
.emit("mpv-process-removed", process)
|
||||
|
||||
Reference in new issue
Block a user