Browse Source

fix: kill lnd process on quit

Ensure that any lnd process started by us is killed when the app quits.

Fix #470
renovate/lint-staged-8.x
Tom Kirkpatrick 6 years ago
parent
commit
bd26d26884
No known key found for this signature in database GPG Key ID: 72203A8EC5967EA8
  1. 11
      app/main.dev.js

11
app/main.dev.js

@ -29,6 +29,8 @@ let didFinishLoad = false
let startedSync = false
let sentGrpcDisconnect = false
let neutrino = null
if (process.env.NODE_ENV === 'production') {
const sourceMapSupport = require('source-map-support')
sourceMapSupport.install()
@ -162,7 +164,7 @@ const startLnd = (alias, autopilot) => {
`${alias ? `--alias=${alias}` : ''}`
]
const neutrino = spawn(lndConfig.lndPath, neutrinoArgs)
neutrino = spawn(lndConfig.lndPath, neutrinoArgs)
.on('error', error => {
lndLog.error(`lnd error: ${error}`)
dialog.showMessageBox({
@ -352,4 +354,11 @@ app.on('open-url', (event, url) => {
mainWindow.show()
})
// Ensure lnd process is killed when the app quits.
app.on('quit', () => {
if (neutrino) {
neutrino.kill()
}
})
export default { startLnd }

Loading…
Cancel
Save