2015-05-19 13:00:06 +02:00
|
|
|
'use strict';
|
2012-09-17 17:40:23 +02:00
|
|
|
var common = require('../common');
|
|
|
|
var assert = require('assert');
|
|
|
|
var path = require('path');
|
|
|
|
var fs = require('fs');
|
|
|
|
|
2015-06-09 20:40:55 +02:00
|
|
|
common.refreshTmpDir();
|
|
|
|
|
2012-09-17 17:40:23 +02:00
|
|
|
var filename = path.join(common.tmpDir, 'watched');
|
|
|
|
fs.writeFileSync(filename, 'quis custodiet ipsos custodes');
|
|
|
|
setTimeout(fs.unlinkSync, 100, filename);
|
|
|
|
|
2016-07-15 21:43:24 +02:00
|
|
|
fs.watchFile(filename, { interval: 50 }, common.mustCall(function(curr, prev) {
|
2012-09-17 17:40:23 +02:00
|
|
|
assert.equal(prev.nlink, 1);
|
|
|
|
assert.equal(curr.nlink, 0);
|
|
|
|
fs.unwatchFile(filename);
|
2016-07-15 21:43:24 +02:00
|
|
|
}));
|