Browse Source

Prevent lock issues due to double internal processes

master
meriadec 7 years ago
parent
commit
a91f3c912e
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 10
      src/main/bridge.js

10
src/main/bridge.js

@ -27,12 +27,17 @@ sentry(() => sentryEnabled, userId)
const killInternalProcess = () => { const killInternalProcess = () => {
if (internalProcess) { if (internalProcess) {
logger.log('killing internal process...') logger.log('killing internal process...')
internalProcess.removeListener('exit', handleExit)
internalProcess.kill('SIGINT') internalProcess.kill('SIGINT')
internalProcess = null internalProcess = null
} }
} }
const forkBundlePath = path.resolve(__dirname, `${__DEV__ ? '../../' : './'}dist/internals`) const forkBundlePath = path.resolve(__dirname, `${__DEV__ ? '../../' : './'}dist/internals`)
const handleExit = code => {
logger.warn(`Internal process ended with code ${code}`)
internalProcess = null
}
const bootInternalProcess = () => { const bootInternalProcess = () => {
logger.log('booting internal process...') logger.log('booting internal process...')
@ -45,10 +50,7 @@ const bootInternalProcess = () => {
}, },
}) })
internalProcess.on('message', handleGlobalInternalMessage) internalProcess.on('message', handleGlobalInternalMessage)
internalProcess.on('exit', code => { internalProcess.on('exit', handleExit)
logger.warn(`Internal process ended with code ${code}`)
internalProcess = null
})
} }
process.on('exit', () => { process.on('exit', () => {

Loading…
Cancel
Save