diff --git a/daily-rotate-file.js b/daily-rotate-file.js index 19adc62..06ec76f 100644 --- a/daily-rotate-file.js +++ b/daily-rotate-file.js @@ -136,8 +136,10 @@ var DailyRotateFile = function (options) { var inp = fs.createReadStream(oldFile); var out = fs.createWriteStream(oldFile + '.gz'); inp.pipe(gzip).pipe(out).on('finish', function () { - if (fs.existsSync(oldFile)) { + try { fs.unlinkSync(oldFile); + } catch (err) { + // ignore becauuse should only happen in bad timing cases } self.emit('archive', oldFile + '.gz'); });