From 80e4e5f2cdae073a4bf480041ed5dfdfbcddfa2e Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Wed, 2 Oct 2013 18:17:46 -0700 Subject: [PATCH] :racehorse: Use fs.statSyncNoException in coffee-cache --- src/coffee-cache.coffee | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/coffee-cache.coffee b/src/coffee-cache.coffee index 6ccb4bcce..b51a7454b 100644 --- a/src/coffee-cache.coffee +++ b/src/coffee-cache.coffee @@ -15,8 +15,9 @@ getCachePath = (coffee) -> path.join(coffeeCacheDir, "#{digest}.coffee") getCachedJavaScript = (cachePath) -> - try - fs.readFileSync(cachePath, 'utf8') if fs.statSync(cachePath).isFile() + if stat = fs.statSyncNoException(cachePath) + try + fs.readFileSync(cachePath, 'utf8') if stat.isFile() compileCoffeeScript = (coffee, filePath, cachePath) -> js = CoffeeScript.compile(coffee, filename: filePath)