fix: selection loss in light mode

This commit is contained in:
Memory 2025-08-17 13:38:49 +08:00 committed by GitHub
parent 68dd3fd01a
commit e176f6db14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -113,7 +113,7 @@ export async function startCore(detached = false): Promise<Promise<void>[]> {
corePath,
['-d', diffWorkDir ? mihomoProfileWorkDir(current) : mihomoWorkDir(), ctlParam, mihomoIpcPath],
{
detached: detached,
detached: true,
stdio: detached ? 'ignore' : undefined,
env: env
}
@ -218,7 +218,7 @@ export async function restartCore(): Promise<void> {
export async function keepCoreAlive(): Promise<void> {
try {
await startCore(true)
if (!child) await startCore(true)
if (child && child.pid) {
await writeFile(path.join(dataDir(), 'core.pid'), child.pid.toString())
}