Skip to content

Commit

Permalink
Wait for async logs
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuaspence committed Jan 20, 2022
1 parent 107ac36 commit 3baa15e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ class Controller {
logger.error('Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions'); /* eslint-disable-line max-len */
logger.error('Exiting...');
logger.error(error.stack);

// Workaround for https://github.com/winstonjs/winston/issues/1629
await new Promise<void>((resolve, reject) => {
logger.winston.on('finish', () => {
setTimeout(() => resolve(), 1000);
});
logger.winston.end();
});
this.exitCallback(1);
}

Expand Down

0 comments on commit 3baa15e

Please sign in to comment.