resolve promise after puppeteer installed when find it not installed before start chat

This commit is contained in:
bossgeekgo
2024-02-16 08:36:40 +08:00
parent 5bcfb280e8
commit 67be994a73
@@ -69,13 +69,24 @@ export const runAutoChat = async () => {
const data = raw
switch (data.type) {
case 'NEED_RESETUP_DEPENDENCIES':
case 'PUPPETEER_DOWNLOAD_ERROR':
case 'PUPPETEER_DOWNLOAD_FINISHED':
case 'PUPPETEER_DOWNLOAD_PROGRESS': {
pipe?.write(JSON.stringify(data) + '\r\n')
break
}
case 'PUPPETEER_DOWNLOAD_FINISHED': {
subProcessOfCheckAndDownloadDependencies?.kill()
pipe?.write(JSON.stringify(data) + '\r\n')
resolve(data)
break
}
case 'PUPPETEER_DOWNLOAD_ERROR': {
subProcessOfCheckAndDownloadDependencies?.kill()
pipe?.write(JSON.stringify(data) + '\r\n')
resolve(data)
break
}
case 'PUPPETEER_MAY_NOT_INSTALLED': {
pipe?.write(JSON.stringify(data) + '\r\n')
resolve(data)
break
}