feat: kill sidecars when update app
This commit is contained in:
parent
30dd298fca
commit
f709117cc4
@ -5,7 +5,7 @@ use crate::{
|
|||||||
};
|
};
|
||||||
use serde_yaml::Mapping;
|
use serde_yaml::Mapping;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
use tauri::State;
|
use tauri::{api, State};
|
||||||
|
|
||||||
/// get all profiles from `profiles.yaml`
|
/// get all profiles from `profiles.yaml`
|
||||||
/// do not acquire the lock of ProfileLock
|
/// do not acquire the lock of ProfileLock
|
||||||
@ -273,6 +273,12 @@ pub async fn patch_verge_config(
|
|||||||
verge.patch_config(payload)
|
verge.patch_config(payload)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// kill all sidecars when update app
|
||||||
|
#[tauri::command]
|
||||||
|
pub fn kill_sidecars() {
|
||||||
|
api::process::kill_children();
|
||||||
|
}
|
||||||
|
|
||||||
/// open app config dir
|
/// open app config dir
|
||||||
#[tauri::command]
|
#[tauri::command]
|
||||||
pub fn open_app_dir() -> Result<(), String> {
|
pub fn open_app_dir() -> Result<(), String> {
|
||||||
|
@ -74,6 +74,7 @@ fn main() -> std::io::Result<()> {
|
|||||||
cmds::restart_sidecar,
|
cmds::restart_sidecar,
|
||||||
cmds::get_sys_proxy,
|
cmds::get_sys_proxy,
|
||||||
cmds::get_cur_proxy,
|
cmds::get_cur_proxy,
|
||||||
|
cmds::kill_sidecars,
|
||||||
cmds::open_app_dir,
|
cmds::open_app_dir,
|
||||||
cmds::open_logs_dir,
|
cmds::open_logs_dir,
|
||||||
// clash
|
// clash
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
DialogContentText,
|
DialogContentText,
|
||||||
DialogTitle,
|
DialogTitle,
|
||||||
} from "@mui/material";
|
} from "@mui/material";
|
||||||
|
import { killSidecars } from "../../services/cmds";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
open: boolean;
|
open: boolean;
|
||||||
@ -31,6 +32,7 @@ const UpdateDialog = (props: Props) => {
|
|||||||
try {
|
try {
|
||||||
setUploading(true);
|
setUploading(true);
|
||||||
uploadingState = true;
|
uploadingState = true;
|
||||||
|
await killSidecars();
|
||||||
await installUpdate();
|
await installUpdate();
|
||||||
await relaunch();
|
await relaunch();
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -64,6 +64,10 @@ export async function getSystemProxy() {
|
|||||||
return invoke<any>("get_sys_proxy");
|
return invoke<any>("get_sys_proxy");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export async function killSidecars() {
|
||||||
|
return invoke<any>("kill_sidecars");
|
||||||
|
}
|
||||||
|
|
||||||
export async function openAppDir() {
|
export async function openAppDir() {
|
||||||
return invoke<void>("open_app_dir");
|
return invoke<void>("open_app_dir");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user