mirror of
https://github.com/nodejs/node.git
synced 2024-12-01 16:10:02 +01:00
3e1b1dd4a9
The copyright and license notice is already in the LICENSE file. There is no justifiable reason to also require that it be included in every file, since the individual files are not individually distributed except as part of the entire package.
34 lines
661 B
JavaScript
34 lines
661 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
|
|
var fs = require('fs');
|
|
var path = require('path');
|
|
|
|
var f = path.join(common.fixturesDir, 'x.txt');
|
|
var f2 = path.join(common.fixturesDir, 'x2.txt');
|
|
|
|
console.log('watching for changes of ' + f);
|
|
|
|
var changes = 0;
|
|
function watchFile() {
|
|
fs.watchFile(f, function(curr, prev) {
|
|
console.log(f + ' change');
|
|
changes++;
|
|
assert.ok(curr.mtime != prev.mtime);
|
|
fs.unwatchFile(f);
|
|
watchFile();
|
|
fs.unwatchFile(f);
|
|
});
|
|
}
|
|
|
|
watchFile();
|
|
|
|
|
|
var fd = fs.openSync(f, 'w+');
|
|
fs.writeSync(fd, 'xyz\n');
|
|
fs.closeSync(fd);
|
|
|
|
process.on('exit', function() {
|
|
assert.ok(changes > 0);
|
|
});
|