mirror of
https://github.com/moku-project/Moku.git
synced 2026-06-13 01:09:56 -05:00
Fix: Installation Server Kill [V2]
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
pkgname=moku
|
pkgname=moku
|
||||||
pkgver=0.4.0
|
pkgver=0.5.0
|
||||||
pkgrel=1
|
pkgrel=1
|
||||||
pkgdesc="Native Linux manga reader frontend for Suwayomi-Server"
|
pkgdesc="Native Linux manga reader frontend for Suwayomi-Server"
|
||||||
arch=('x86_64')
|
arch=('x86_64')
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "moku",
|
"name": "moku",
|
||||||
"version": "0.1.0",
|
"version": "0.5.0",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
|
|||||||
+26
-3
@@ -121,9 +121,31 @@ fn kill_tachidesk(app: &tauri::AppHandle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(target_os = "windows")]
|
#[cfg(target_os = "windows")]
|
||||||
let _ = std::process::Command::new("taskkill")
|
{
|
||||||
.args(["/F", "/FI", "IMAGENAME eq java*"])
|
use std::os::windows::process::CommandExt;
|
||||||
.status();
|
const CREATE_NO_WINDOW: u32 = 0x08000000;
|
||||||
|
|
||||||
|
let _ = std::process::Command::new("taskkill")
|
||||||
|
.args(["/F", "/FI", "IMAGENAME eq java.exe"])
|
||||||
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
|
.status();
|
||||||
|
|
||||||
|
// Poll until no java.exe remains (up to ~3 s) so the installer can
|
||||||
|
// overwrite the JRE DLLs without hitting a sharing-violation error.
|
||||||
|
for _ in 0..30 {
|
||||||
|
let still_running = std::process::Command::new("tasklist")
|
||||||
|
.args(["/FI", "IMAGENAME eq java.exe", "/NH"])
|
||||||
|
.creation_flags(CREATE_NO_WINDOW)
|
||||||
|
.output()
|
||||||
|
.map(|o| String::from_utf8_lossy(&o.stdout).contains("java.exe"))
|
||||||
|
.unwrap_or(false);
|
||||||
|
|
||||||
|
if !still_running {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
std::thread::sleep(std::time::Duration::from_millis(100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#[cfg(not(target_os = "windows"))]
|
#[cfg(not(target_os = "windows"))]
|
||||||
let _ = std::process::Command::new("pkill")
|
let _ = std::process::Command::new("pkill")
|
||||||
@@ -131,6 +153,7 @@ fn kill_tachidesk(app: &tauri::AppHandle) {
|
|||||||
.status();
|
.status();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const DEFAULT_SERVER_CONF: &str = r#"server.ip = "127.0.0.1"
|
const DEFAULT_SERVER_CONF: &str = r#"server.ip = "127.0.0.1"
|
||||||
server.port = 4567
|
server.port = 4567
|
||||||
server.webUIEnabled = false
|
server.webUIEnabled = false
|
||||||
|
|||||||
@@ -562,10 +562,9 @@
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
if (IS_WINDOWS) {
|
if (IS_WINDOWS) {
|
||||||
// Kill Suwayomi before installing — its JRE DLLs will be locked otherwise
|
// Kill Suwayomi before installing — its JRE DLLs will be locked otherwise.
|
||||||
|
// kill_server blocks on the Rust side until java.exe is fully gone.
|
||||||
try { await invoke("kill_server"); } catch {}
|
try { await invoke("kill_server"); } catch {}
|
||||||
// Give the process a moment to fully release file handles
|
|
||||||
await new Promise(res => setTimeout(res, 1500));
|
|
||||||
// Windows: Tauri updater downloads + runs passive NSIS installer
|
// Windows: Tauri updater downloads + runs passive NSIS installer
|
||||||
await invoke("download_and_install_update");
|
await invoke("download_and_install_update");
|
||||||
updatePhase = "ready";
|
updatePhase = "ready";
|
||||||
|
|||||||
Reference in New Issue
Block a user