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