Skip to content

Commit

Permalink
fix: return hasher when make errors
Browse files Browse the repository at this point in the history
  • Loading branch information
fent committed Oct 5, 2020
1 parent c6a2af1 commit 84ecf65
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions lib/make.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const make = exports.make = (announce, dir, files, options, callback) => {
hasher.emit('error', err);
callback(err);
});
return;
return hasher;
}

// Check list of files is not empty.
Expand All @@ -102,7 +102,7 @@ const make = exports.make = (announce, dir, files, options, callback) => {
hasher.emit('error', err);
callback(err);
});
return;
return hasher;
}

// Make metadata object.
Expand All @@ -119,7 +119,7 @@ const make = exports.make = (announce, dir, files, options, callback) => {
hasher.emit('error', err);
callback(err);
});
return;
return hasher;
}
metadata['announce-list'] = options.announceList;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/read.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module.exports = (file, validate = true, callback) => {
rs.pipe(bstream);

bstream.on('error', (err) => {
if (rs.hasOwnProperty('fd')) {
if ('fd' in rs) {
fs.close(rs.fd);
}
callback(err);
Expand Down

0 comments on commit 84ecf65

Please sign in to comment.