0
0
mirror of https://github.com/nodejs/node.git synced 2024-11-30 07:27:22 +01:00
nodejs/test/mjsunit/test-stat-handler.js
2009-11-17 15:05:01 +01:00

28 lines
491 B
JavaScript

process.mixin(require("./common"));
var path = require("path");
var f = path.join(fixturesDir, "x.txt");
var f2 = path.join(fixturesDir, "x2.txt");
puts("watching for changes of " + f);
var changes = 0;
process.watchFile(f, function () {
puts(f + " change");
changes++;
process.unwatchFile(f);
});
var File = require("file").File;
var file = new File(f, 'w+');
file.write('xyz\n');
file.close().wait();
process.addListener("exit", function () {
assertTrue(changes > 0);
});