diff options
Diffstat (limited to 'lib/fs.js')
-rw-r--r-- | lib/fs.js | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/fs.js b/lib/fs.js index 8b3b6b233e8..48724272062 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -912,14 +912,20 @@ function inStatWatchers(filename) { fs.watchFile = function(filename) { var stat; - var options; var listener; + var options = { + // Poll interval in milliseconds. 5007 is what libev used to use. It's + // a little on the slow side but let's stick with it for now to keep + // behavioral changes to a minimum. + interval: 5007, + persistent: true, + }; + if ('object' == typeof arguments[1]) { - options = arguments[1]; + options = util._extend(options, arguments[1]); listener = arguments[2]; } else { - options = {}; listener = arguments[1]; } @@ -927,9 +933,6 @@ fs.watchFile = function(filename) { throw new Error('watchFile requires a listener function'); } - if (options.persistent === undefined) options.persistent = true; - if (options.interval === undefined) options.interval = 0; - if (inStatWatchers(filename)) { stat = statWatchers[filename]; } else { |