Skip to content

Commit

Permalink
Fix bug that a resource leak
Browse files Browse the repository at this point in the history
  • Loading branch information
segayuu committed May 11, 2020
1 parent 742d62c commit c8af95d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/database.js
Expand Up @@ -134,7 +134,10 @@ class Database {
const rs = fs.createReadStream(path, 'utf8');

const promise = new Promise((resolve, reject) => {
parseStream.once('error', reject);
parseStream.once('error', err => {
rs.destroy(err);
reject(err);
});
parseStream.once('end', resolve);

rs.once('error', reject);
Expand Down

0 comments on commit c8af95d

Please sign in to comment.