Permalink
Browse files

dep use of watchFile - but leave it on mac... ::sigh::

  • Loading branch information...
remy committed Apr 23, 2012
1 parent ae1255e commit 54379825084a7c5cb07e28d70d6a5c6b936482fc
Showing with 7 additions and 4 deletions.
  1. +6 −3 nodemon.js
  2. +1 −1 package.json
View
@@ -25,6 +25,7 @@ var fs = require('fs'),
platform = process.platform,
isWindows = platform === 'win32',
noWatch = (platform !== 'win32') || !fs.watch, // && platform !== 'linux' - removed linux fs.watch usage #72
+ watchFile = platform === 'darwin' ? fs.watchFile : fs.watch, // lame :(
// create once, reuse as needed
reEscComments = /\\#/g,
reUnescapeComments = /\^\^/g, // note that '^^' is used in place of escaped comments
@@ -147,6 +148,7 @@ function startMonitor() {
changeFunction(lastStarted, function (files) {
if (files.length) {
// filter ignored files
+ console.log(ignoreFiles);
if (ignoreFiles.length) {
files = files.filter(function(file) {
return !reIgnoreFiles.test(file);
@@ -194,19 +196,20 @@ function readIgnoreFile(curr, prev) {
// unless the ignore file was actually modified, do no re-read it
if(curr && prev && curr.mtime.valueOf() === prev.mtime.valueOf()) return;
- fs.unwatchFile(ignoreFilePath);
+ if (platform === 'darwin') fs.unwatchFile(ignoreFilePath);
// Check if ignore file still exists. Vim tends to delete it before replacing with changed file
exists(ignoreFilePath, function(exists) {
if (program.options.verbose) util.log('[nodemon] reading ignore list');
// ignoreFiles = ignoreFiles.concat([flag, ignoreFilePath]);
// addIgnoreRule(flag);
- addIgnoreRule(ignoreFilePath);
+ addIgnoreRule(ignoreFilePath.substring(2)); // ignore the ./ part of the filename
fs.readFileSync(ignoreFilePath).toString().split(/\n/).forEach(function (rule, i) {
addIgnoreRule(rule);
});
- fs.watchFile(ignoreFilePath, { persistent: false }, readIgnoreFile);
+
+ watchFile(ignoreFilePath, { persistent: false }, readIgnoreFile);
});
}
View
@@ -9,7 +9,7 @@
"repository": { "type" : "git", "url" : "http://github.com/remy/nodemon.git" },
"description": "Simple monitor script for use during development of a node.js app.",
"keywords": ["monitor", "development", "restart", "autoload", "reload", "terminal"],
- "version": "0.6.15",
+ "version": "0.6.16",
"preferGlobal" : "true",
"licenses": [{
"type": "MIT",

0 comments on commit 5437982

Please sign in to comment.