From 27b739b0819ea748eabbf1faf07f204e91853d20 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 7 Apr 2016 16:16:39 +0100 Subject: [PATCH] don't log errors when files have disappeared from build directory --- services/clsi/app/coffee/OutputCacheManager.coffee | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/services/clsi/app/coffee/OutputCacheManager.coffee b/services/clsi/app/coffee/OutputCacheManager.coffee index 5f7558a50f..aff332be58 100644 --- a/services/clsi/app/coffee/OutputCacheManager.coffee +++ b/services/clsi/app/coffee/OutputCacheManager.coffee @@ -125,8 +125,11 @@ module.exports = OutputCacheManager = _checkFileIsSafe: (src, callback = (error, isSafe) ->) -> # check if we have a valid file to copy into the cache fs.stat src, (err, stats) -> - if err? - # some problem reading the file + if err?.code is 'ENOENT' + logger.warn err: err, file: src, "file has disappeared before copying to build cache" + callback(err, false) + else if err? + # some other problem reading the file logger.error err: err, file: src, "stat error for file in cache" callback(err, false) else if not stats.isFile() @@ -140,7 +143,10 @@ module.exports = OutputCacheManager = _copyFile: (src, dst, callback) -> # copy output file into the cache fse.copy src, dst, (err) -> - if err? + if err?.code is 'ENOENT' + logger.warn err: err, file: src, "file has disappeared when copying to build cache" + callback(err, false) + else if err? logger.error err: err, src: src, dst: dst, "copy error for file in cache" callback(err) else @@ -155,4 +161,4 @@ module.exports = OutputCacheManager = return callback(null, true) if Settings.clsi?.archive_logs and Path.basename(src) in ["output.log", "output.blg"] return callback(null, true) - return callback(null, false) \ No newline at end of file + return callback(null, false)