mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-08 21:38:13 -05:00
🐛 Fix: sync with picgo, suppress epiep error
This commit is contained in:
parent
d5f7121a3f
commit
dc1458ffef
@ -54,6 +54,7 @@
|
|||||||
"dexie": "^3.2.3",
|
"dexie": "^3.2.3",
|
||||||
"electron-updater": "^5.3.0",
|
"electron-updater": "^5.3.0",
|
||||||
"element-plus": "^2.2.32",
|
"element-plus": "^2.2.32",
|
||||||
|
"epipebomb": "^1.0.0",
|
||||||
"fast-xml-parser": "^4.1.1",
|
"fast-xml-parser": "^4.1.1",
|
||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"fs-extra": "^11.1.0",
|
"fs-extra": "^11.1.0",
|
||||||
|
@ -9,7 +9,7 @@ const logger = getLogger(LOG_PATH, 'PicList')
|
|||||||
// since the error may occur in picgo-core
|
// since the error may occur in picgo-core
|
||||||
// so we can't use the log from picgo
|
// so we can't use the log from picgo
|
||||||
|
|
||||||
const handleProcessError = (error: Error) => {
|
const handleProcessError = (error: Error | string) => {
|
||||||
logger('error', error)
|
logger('error', error)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -20,3 +20,21 @@ process.on('uncaughtException', error => {
|
|||||||
process.on('unhandledRejection', (error: any) => {
|
process.on('unhandledRejection', (error: any) => {
|
||||||
handleProcessError(error)
|
handleProcessError(error)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// acconrding to https://github.com/Molunerfinn/PicGo/commit/7363be798cfef11e980934e542817ff1d6c04389#diff-896d0db4fbd446798fbffec14d456b4cd98d4c72c46856c770a585fa7ab0926f
|
||||||
|
function bootstrapEPIPESuppression () {
|
||||||
|
let suppressing = false
|
||||||
|
function logEPIPEErrorOnce () {
|
||||||
|
if (suppressing) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
suppressing = true
|
||||||
|
handleProcessError('Detected EPIPE error; suppressing further EPIPE errors')
|
||||||
|
}
|
||||||
|
|
||||||
|
require('epipebomb')(process.stdout, logEPIPEErrorOnce)
|
||||||
|
require('epipebomb')(process.stderr, logEPIPEErrorOnce)
|
||||||
|
}
|
||||||
|
|
||||||
|
bootstrapEPIPESuppression()
|
||||||
|
4
src/universal/types/global.d.ts
vendored
4
src/universal/types/global.d.ts
vendored
@ -3,3 +3,7 @@
|
|||||||
declare var PICGO_GUI_VERSION: string
|
declare var PICGO_GUI_VERSION: string
|
||||||
declare var PICGO_CORE_VERSION: string
|
declare var PICGO_CORE_VERSION: string
|
||||||
declare var notificationList: IAppNotification[]
|
declare var notificationList: IAppNotification[]
|
||||||
|
|
||||||
|
declare module 'epipebomb' {
|
||||||
|
export default function epipebomb(stream: NodeJS.Process['stdout'], callback: () => void): void
|
||||||
|
}
|
@ -6829,6 +6829,11 @@ env-paths@^2.2.0:
|
|||||||
resolved "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
|
resolved "https://registry.npmjs.org/env-paths/-/env-paths-2.2.1.tgz#420399d416ce1fbe9bc0a07c62fa68d67fd0f8f2"
|
||||||
integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==
|
integrity sha512-+h1lkLKhZMTYjog1VEpJNG7NZJWcuc2DDk/qsqSTRRCOXiLjeQ1d1/udrUGhqMxUgAlwKNZ0cf2uqan5GLuS2A==
|
||||||
|
|
||||||
|
epipebomb@^1.0.0:
|
||||||
|
version "1.0.0"
|
||||||
|
resolved "https://registry.npmjs.org/epipebomb/-/epipebomb-1.0.0.tgz#57d1deda1d6bc81622b118a75fe6b5a7d34f6d88"
|
||||||
|
integrity sha512-NGv0bGlgetsi6ad5BuG1Pa9zpLLCeXeIa6wFGc+l0Emhr5rUlW8Rjx96NONlXZl4tMMaEODszyyy1A8ENjFoKA==
|
||||||
|
|
||||||
error-ex@^1.3.1:
|
error-ex@^1.3.1:
|
||||||
version "1.3.2"
|
version "1.3.2"
|
||||||
resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
|
resolved "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz#b4ac40648107fdcdcfae242f428bea8a14d4f1bf"
|
||||||
|
Loading…
Reference in New Issue
Block a user