Skip to content

Commit

Permalink
Fixed Brikkit continuing to run when Brickadia crashed or exited
Browse files Browse the repository at this point in the history
  • Loading branch information
n42k committed Sep 14, 2019
1 parent 13ace74 commit f0b2623
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 1 addition & 2 deletions brickadia.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,8 @@ class Brickadia {
process.exit();
});

process.on('uncaughtException', err => {
process.on('uncaughtException', _err => {
sp.kill();
throw err;
});
}

Expand Down
3 changes: 3 additions & 0 deletions brikkit.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ class Brikkit {
this._pluginSystem = new PluginSystem();

this._brickadia.on('out', line => this._handleBrickadiaLine(line));
this._brickadia.on('close', () => {
throw new Error('Brickadia closed (probable crash)');
});

this._terminal = new Terminal();
this._terminal.on('out', line => {
Expand Down
5 changes: 3 additions & 2 deletions server.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
}

process.on('uncaughtException', async err => {
process.on('uncaughtException', err => {
console.log(' --- SERVER END --- ');
stream.end();
console.log(err.stack);

fs.appendFileSync(logFile, err.stack);
process.exit();
});

0 comments on commit f0b2623

Please sign in to comment.