Skip to content

Commit

Permalink
fix: ignore ENOENT error when cleaning logdir
Browse files Browse the repository at this point in the history
PR-URL: #90
Reviewed-BY: hyj1991 <[email protected]>
  • Loading branch information
Claude-Ray authored Oct 26, 2020
1 parent 1c82aa5 commit fbfc601
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/clean.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,11 @@ module.exports = function clean(logdir) {

// clean these files
needClean = needClean.concat(needCleanSocks);
needClean.forEach(filename => fs.unlinkSync(path.join(logdir, filename)));
needClean.forEach(filename => {
try {
fs.unlinkSync(path.join(logdir, filename));
} catch (err) /* istanbul ignore next */ {
console.error(err);
}
});
};

0 comments on commit fbfc601

Please sign in to comment.