WIP: for ui package, move the core logic of run core to child process, and rerun run child process in daemon process when uncaught error makes process terminated. TODO: test the flow

This commit is contained in:
geekgeekrun
2024-03-16 03:25:44 +08:00
parent f0e7eadfbc
commit 76db85d01e
6 changed files with 70 additions and 10 deletions
+2 -2
View File
@@ -16,7 +16,7 @@ import { checkCookieListFormat } from '../../common/utils/cookie'
import { getAnyAvailablePuppeteerExecutable } from '../flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/utils/puppeteer-executable/index'
import { DOWNLOAD_ERROR_EXIT_CODE } from '../flow/CHECK_AND_DOWNLOAD_DEPENDENCIES/index'
import { sleep } from '@geekgeekrun/utils/sleep.mjs'
import { AUTO_CHAT_ERROR_EXIT_CODE } from '../flow/GEEK_AUTO_START_CHAT_WITH_BOSS'
import { AUTO_CHAT_ERROR_EXIT_CODE } from '../../common/enums/auto-start-chat'
let mainWindow: BrowserWindow | null = null
export function createMainWindow(): void {
@@ -123,7 +123,7 @@ export function createMainWindow(): void {
}
const subProcessEnv = {
...process.env,
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'geekAutoStartWithBoss',
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'geekAutoStartWithBossDaemon',
PUPPETEER_EXECUTABLE_PATH: puppeteerExecutable.executablePath
}
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {