mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 05:00:30 +08:00
fix start error when using silent log-level
This commit is contained in:
parent
dfdf044b48
commit
c4618b4ddb
@ -5,3 +5,7 @@
|
||||
### New Features
|
||||
|
||||
- 支持自动开启轻量模式
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
- 修复日志等级为静默时,无法正常启动的问题
|
||||
|
||||
@ -21,6 +21,8 @@ export async function generateProfile(): Promise<void> {
|
||||
const currentProfile = await overrideProfile(current, await getProfile(current))
|
||||
const controledMihomoConfig = await getControledMihomoConfig()
|
||||
const profile = deepMerge(currentProfile, controledMihomoConfig)
|
||||
// 确保可以拿到基础日志信息
|
||||
profile['log-level'] = 'info'
|
||||
runtimeConfig = profile
|
||||
runtimeConfigStr = yaml.stringify(profile)
|
||||
await writeFile(mihomoWorkConfigPath(), runtimeConfigStr)
|
||||
|
||||
@ -24,7 +24,8 @@ import {
|
||||
stopMihomoConnections,
|
||||
stopMihomoTraffic,
|
||||
stopMihomoLogs,
|
||||
stopMihomoMemory
|
||||
stopMihomoMemory,
|
||||
patchMihomoConfig
|
||||
} from './mihomoApi'
|
||||
import chokidar from 'chokidar'
|
||||
import { readFile, rm, writeFile } from 'fs/promises'
|
||||
@ -47,6 +48,7 @@ let retry = 10
|
||||
|
||||
export async function startCore(detached = false): Promise<Promise<void>[]> {
|
||||
const { core = 'mihomo', autoSetDNS = true, encryptedPassword } = await getAppConfig()
|
||||
const { 'log-level': logLevel } = await getControledMihomoConfig()
|
||||
if (existsSync(path.join(dataDir(), 'core.pid'))) {
|
||||
const pid = parseInt(await readFile(path.join(dataDir(), 'core.pid'), 'utf-8'))
|
||||
try {
|
||||
@ -136,6 +138,7 @@ export async function startCore(detached = false): Promise<Promise<void>[]> {
|
||||
} catch {
|
||||
// ignore
|
||||
}
|
||||
await patchMihomoConfig({ 'log-level': logLevel })
|
||||
resolve()
|
||||
}
|
||||
})
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user