Kill child process on exit
This commit is contained in:
parent
9cf9d341b3
commit
2e9e300d0c
1 changed files with 6 additions and 1 deletions
|
@ -3,7 +3,7 @@ import Xev from 'xev';
|
||||||
|
|
||||||
const ev = new Xev();
|
const ev = new Xev();
|
||||||
|
|
||||||
export default function() {
|
export default function () {
|
||||||
const log: any[] = [];
|
const log: any[] = [];
|
||||||
|
|
||||||
const p = childProcess.fork(__dirname + '/notes-stats-child.js');
|
const p = childProcess.fork(__dirname + '/notes-stats-child.js');
|
||||||
|
@ -17,4 +17,9 @@ export default function() {
|
||||||
ev.on('requestNotesStatsLog', id => {
|
ev.on('requestNotesStatsLog', id => {
|
||||||
ev.emit('notesStatsLog:' + id, log);
|
ev.emit('notesStatsLog:' + id, log);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
process.on('exit', code => {
|
||||||
|
process.kill(p.pid);
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue