mirror of
https://github.com/geekgeekrun/geekgeekrun.git
synced 2026-09-07 00:17:17 +08:00
add error catcher for pipeForRead; remove the logic exit process on pipe error
This commit is contained in:
@@ -150,6 +150,9 @@ export const waitForProcessHandShakeAndRunAutoChat = () => {
|
|||||||
setSuicideTimer()
|
setSuicideTimer()
|
||||||
|
|
||||||
const pipeForRead: fs.ReadStream = fs.createReadStream(null, { fd: 3 })
|
const pipeForRead: fs.ReadStream = fs.createReadStream(null, { fd: 3 })
|
||||||
|
pipeForRead.on('error', () => {
|
||||||
|
return
|
||||||
|
})
|
||||||
const pipeForReadWithJsonParser = pipeForRead.pipe(JSONStream.parse())
|
const pipeForReadWithJsonParser = pipeForRead.pipe(JSONStream.parse())
|
||||||
pipeForReadWithJsonParser?.on('data', function waitForCanRun(data) {
|
pipeForReadWithJsonParser?.on('data', function waitForCanRun(data) {
|
||||||
if (data.type === 'GEEK_AUTO_START_CHAT_CAN_BE_RUN') {
|
if (data.type === 'GEEK_AUTO_START_CHAT_CAN_BE_RUN') {
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import { type Stream } from 'stream'
|
import { type Stream } from 'stream'
|
||||||
import { app } from 'electron'
|
|
||||||
const pipeSet = new WeakSet<Stream>()
|
const pipeSet = new WeakSet<Stream>()
|
||||||
|
|
||||||
export const pipeWriteRegardlessError = async (
|
export const pipeWriteRegardlessError = async (
|
||||||
@@ -17,8 +16,6 @@ export const pipeWriteRegardlessError = async (
|
|||||||
return pipe?.write(chunk, option, (error) => {
|
return pipe?.write(chunk, option, (error) => {
|
||||||
if (error) {
|
if (error) {
|
||||||
console.log('pipe.write Error', error)
|
console.log('pipe.write Error', error)
|
||||||
app.exit(1)
|
|
||||||
process.exit(1)
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user