Skip to content
This repository has been archived by the owner on Jun 29, 2019. It is now read-only.

Commit

Permalink
Fixed that worker process doesn't be killed while app is dead #10
Browse files Browse the repository at this point in the history
  • Loading branch information
Heejin committed Mar 23, 2016
1 parent a5d68b4 commit a4be0cb
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/main-es6/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const cp = require('child_process');
const fs = require('fs');
const path = require('path');
const logger = require('../utils/logger');
const app = require('electron').app;

module.exports = (context) => {
const rpc = context.rpc;
Expand Down Expand Up @@ -46,6 +47,12 @@ module.exports = (context) => {
workerProcess.on('message', (msg) => {
handleWorkerMessage(msg);
});
app.on('quit', () => {
try {
if (workerProcess)
workerProcess.kill();
} catch (e) { }
});
}

rpc.on('search', (evt, params) => {
Expand Down

0 comments on commit a4be0cb

Please sign in to comment.