From 7d430f77e5e3bfd1decceacf1cd04c100c91988a Mon Sep 17 00:00:00 2001 From: Young Hahn Date: Mon, 31 Oct 2011 02:40:47 -0400 Subject: [PATCH] Use persistent:false on watchFile to allow tests to exit. --- lib/mbtiles.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/mbtiles.js b/lib/mbtiles.js index 2f1ccda..90be990 100644 --- a/lib/mbtiles.js +++ b/lib/mbtiles.js @@ -93,7 +93,12 @@ MBTiles.prototype._open = function(uri) { }, function(err, info) { if (err) return error(err); mbtiles._info = info; - fs.watchFile(mbtiles.filename, { interval: 1000 }, function(cur, prev) { + fs.watchFile(mbtiles.filename, { + // Indicates that the node process may exit if the file watcher + // is the only thing in the event loop. + persistent: false, + interval: 1000 + }, function(cur, prev) { if (cur.mtime != prev.mtime) { fs.unwatchFile(mbtiles.filename); delete cache[key];