mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 03:32:17 +08:00
catch core panic log
This commit is contained in:
parent
94c126b601
commit
94cc2f59c8
|
@ -34,7 +34,7 @@ import { readFile, rm, writeFile } from 'fs/promises'
|
||||||
import { promisify } from 'util'
|
import { promisify } from 'util'
|
||||||
import { mainWindow } from '..'
|
import { mainWindow } from '..'
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
import { existsSync } from 'fs'
|
import { createWriteStream, existsSync } from 'fs'
|
||||||
import { uploadRuntimeConfig } from '../resolve/gistApi'
|
import { uploadRuntimeConfig } from '../resolve/gistApi'
|
||||||
import { startMonitor } from '../resolve/trafficMonitor'
|
import { startMonitor } from '../resolve/trafficMonitor'
|
||||||
|
|
||||||
|
@ -84,7 +84,8 @@ export async function startCore(detached = false): Promise<Promise<void>[]> {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
const stdout = createWriteStream(logPath(), { flags: 'a' })
|
||||||
|
const stderr = createWriteStream(logPath(), { flags: 'a' })
|
||||||
child = spawn(
|
child = spawn(
|
||||||
corePath,
|
corePath,
|
||||||
['-d', diffWorkDir ? mihomoProfileWorkDir(current) : mihomoWorkDir(), ctlParam, mihomoIpcPath],
|
['-d', diffWorkDir ? mihomoProfileWorkDir(current) : mihomoWorkDir(), ctlParam, mihomoIpcPath],
|
||||||
|
@ -111,9 +112,8 @@ export async function startCore(detached = false): Promise<Promise<void>[]> {
|
||||||
await stopCore()
|
await stopCore()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
child.stdout?.on('data', async (data) => {
|
child.stdout?.pipe(stdout)
|
||||||
await writeFile(logPath(), data, { flag: 'a' })
|
child.stderr?.pipe(stderr)
|
||||||
})
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
child.stdout?.on('data', async (data) => {
|
child.stdout?.on('data', async (data) => {
|
||||||
const str = data.toString()
|
const str = data.toString()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user