mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
try to fix relaunch error
This commit is contained in:
parent
7a1518c156
commit
317b9e8218
@ -14,7 +14,11 @@ import {
|
|||||||
startMihomoTraffic,
|
startMihomoTraffic,
|
||||||
startMihomoConnections,
|
startMihomoConnections,
|
||||||
startMihomoLogs,
|
startMihomoLogs,
|
||||||
startMihomoMemory
|
startMihomoMemory,
|
||||||
|
stopMihomoConnections,
|
||||||
|
stopMihomoTraffic,
|
||||||
|
stopMihomoLogs,
|
||||||
|
stopMihomoMemory
|
||||||
} from './mihomoApi'
|
} from './mihomoApi'
|
||||||
import chokidar from 'chokidar'
|
import chokidar from 'chokidar'
|
||||||
import { writeFile } from 'fs/promises'
|
import { writeFile } from 'fs/promises'
|
||||||
@ -22,12 +26,7 @@ import { promisify } from 'util'
|
|||||||
import { mainWindow } from '..'
|
import { mainWindow } from '..'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
chokidar
|
chokidar.watch(path.join(mihomoCoreDir(), 'meta-update')).on('unlinkDir', async () => {
|
||||||
.watch(path.join(mihomoCoreDir(), 'meta-update'))
|
|
||||||
.on('all', (event, path) => {
|
|
||||||
console.log(event, path)
|
|
||||||
})
|
|
||||||
.on('unlinkDir', async () => {
|
|
||||||
try {
|
try {
|
||||||
await stopCore(true)
|
await stopCore(true)
|
||||||
await startCore()
|
await startCore()
|
||||||
@ -125,6 +124,10 @@ export async function stopCore(force = false): Promise<void> {
|
|||||||
child.removeAllListeners()
|
child.removeAllListeners()
|
||||||
child.kill('SIGINT')
|
child.kill('SIGINT')
|
||||||
}
|
}
|
||||||
|
stopMihomoTraffic()
|
||||||
|
stopMihomoConnections()
|
||||||
|
stopMihomoLogs()
|
||||||
|
stopMihomoMemory()
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function restartCore(): Promise<void> {
|
export async function restartCore(): Promise<void> {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user