From 33c7f6679b331458cdacaac0995eb036dbde406c Mon Sep 17 00:00:00 2001 From: geekgeekrun Date: Sat, 24 Feb 2024 12:33:36 +0800 Subject: [PATCH] fix not sync changed in GEEK_AUTO_START_CHAT_WITH_BOSS - use getAnyAvailablePuppeteerExecutablePath instead checkCachedPuppeteerExecutable to check isPuppeteerExecutable --- .../src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS.ts b/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS.ts index d883ef7..e2be779 100644 --- a/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS.ts +++ b/packages/ui/src/main/flow/GEEK_AUTO_START_CHAT_WITH_BOSS.ts @@ -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