Skip to content

Commit

Permalink
fix: check if destroy is function
Browse files Browse the repository at this point in the history
  • Loading branch information
Kalin Krustev committed Oct 3, 2020
1 parent c0662d4 commit 9607d1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions modules/bunyan.js
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ function Bunyan(options) {
const destroyTimeout = setTimeout(() => {
if (!destroyed) {
destroyed = true;
stream.stream.destroy();
typeof stream.stream.destroy === 'function' && stream.stream.destroy();
}
}, 5000);
stream.stream.end(() => {
if (!destroyed) {
destroyed = true;
clearTimeout(destroyTimeout);
stream.stream.destroy();
typeof stream.stream.destroy === 'function' && stream.stream.destroy();
}
});
}
Expand Down

0 comments on commit 9607d1b

Please sign in to comment.