mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-08 17:09:07 +08:00
handle the scenario when user remove any chromium executable before click start job hunt
This commit is contained in:
@@ -4,7 +4,6 @@ import * as childProcess from 'node:child_process'
|
|||||||
import {
|
import {
|
||||||
ensureConfigFileExist,
|
ensureConfigFileExist,
|
||||||
ensureStorageFileExist,
|
ensureStorageFileExist,
|
||||||
|
|
||||||
configFileNameList,
|
configFileNameList,
|
||||||
readConfigFile,
|
readConfigFile,
|
||||||
writeConfigFile,
|
writeConfigFile,
|
||||||
@@ -67,7 +66,7 @@ export function createMainWindow(): void {
|
|||||||
return readConfigFile(fileName)
|
return readConfigFile(fileName)
|
||||||
})
|
})
|
||||||
const result = {
|
const result = {
|
||||||
config: {},
|
config: {}
|
||||||
}
|
}
|
||||||
|
|
||||||
configFileNameList.forEach((fileName, index) => {
|
configFileNameList.forEach((fileName, index) => {
|
||||||
@@ -109,11 +108,14 @@ export function createMainWindow(): void {
|
|||||||
if (subProcessOfPuppeteer) {
|
if (subProcessOfPuppeteer) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
const puppeteerExecutable = await getAnyAvailablePuppeteerExecutable()
|
||||||
|
if (!puppeteerExecutable) {
|
||||||
|
return Promise.reject('NEED_TO_CHECK_RUNTIME_DEPENDENCIES')
|
||||||
|
}
|
||||||
const subProcessEnv = {
|
const subProcessEnv = {
|
||||||
...process.env,
|
...process.env,
|
||||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'geekAutoStartWithBoss',
|
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'geekAutoStartWithBoss',
|
||||||
PUPPETEER_EXECUTABLE_PATH: (await getAnyAvailablePuppeteerExecutable())!.executablePath
|
PUPPETEER_EXECUTABLE_PATH: puppeteerExecutable.executablePath
|
||||||
}
|
}
|
||||||
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
subProcessOfPuppeteer = childProcess.spawn(process.argv[0], process.argv.slice(1), {
|
||||||
env: subProcessEnv,
|
env: subProcessEnv,
|
||||||
@@ -168,7 +170,7 @@ export function createMainWindow(): void {
|
|||||||
}
|
}
|
||||||
const subProcessEnv = {
|
const subProcessEnv = {
|
||||||
...process.env,
|
...process.env,
|
||||||
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'checkAndDownloadDependenciesForInit',
|
MAIN_BOSSGEEKGO_UI_RUN_MODE: 'checkAndDownloadDependenciesForInit'
|
||||||
}
|
}
|
||||||
subProcessOfCheckAndDownloadDependencies = childProcess.spawn(
|
subProcessOfCheckAndDownloadDependencies = childProcess.spawn(
|
||||||
process.argv[0],
|
process.argv[0],
|
||||||
@@ -191,7 +193,7 @@ export function createMainWindow(): void {
|
|||||||
}
|
}
|
||||||
case 'PUPPETEER_DOWNLOAD_ENCOUNTER_ERROR': {
|
case 'PUPPETEER_DOWNLOAD_ENCOUNTER_ERROR': {
|
||||||
console.error(data)
|
console.error(data)
|
||||||
break;
|
break
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user