fix not sync changed in GEEK_AUTO_START_CHAT_WITH_BOSS - use getAnyAvailablePuppeteerExecutablePath instead checkCachedPuppeteerExecutable to check isPuppeteerExecutable

This commit is contained in:
geekgeekrun
2024-02-24 12:33:36 +08:00
parent 8331ee172b
commit 33c7f6679b

View File

@@ -3,10 +3,8 @@ import { app } from 'electron'
import { SyncHook, AsyncSeriesHook } from 'tapable'
import { readConfigFile } from '@geekgeekrun/geek-auto-start-chat-with-boss/runtime-file-utils.mjs'
import * as net from 'net'
import {
checkCachedPuppeteerExecutable,
} from './CHECK_AND_DOWNLOAD_DEPENDENCIES/check-and-download-puppeteer-executable'
import { pipeWriteRegardlessError } from './utils/pipe'
import { getAnyAvailablePuppeteerExecutablePath } from './CHECK_AND_DOWNLOAD_DEPENDENCIES'
const { groupRobotAccessToken: dingTalkAccessToken } = readConfigFile('dingtalk.json')
@@ -29,7 +27,7 @@ export const runAutoChat = async () => {
let pipe: null | net.Socket = null
try {
pipe = new net.Socket({ fd: 3 })
} catch {
} catch (err) {
console.warn('pipe is not available')
}
pipeWriteRegardlessError(
@@ -46,12 +44,13 @@ export const runAutoChat = async () => {
type: 'PUPPETEER_INITIALIZE_SUCCESSFULLY'
}) + '\r\n'
)
} catch {
} catch (err) {
console.error(err)
app.exit(1)
return
}
const isPuppeteerExecutable = await checkCachedPuppeteerExecutable()
const isPuppeteerExecutable = !!(await getAnyAvailablePuppeteerExecutablePath())
if (!isPuppeteerExecutable) {
app.exit(1)
return