mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
534 B
28 lines
534 B
15 years ago
|
process.mixin(require("../common"));
|
||
15 years ago
|
|
||
|
var path = require("path");
|
||
|
|
||
|
var f = path.join(fixturesDir, "x.txt");
|
||
|
var f2 = path.join(fixturesDir, "x2.txt");
|
||
|
|
||
15 years ago
|
puts("watching for changes of " + f);
|
||
|
|
||
15 years ago
|
var changes = 0;
|
||
15 years ago
|
process.watchFile(f, function (curr, prev) {
|
||
15 years ago
|
puts(f + " change");
|
||
|
changes++;
|
||
15 years ago
|
assert.ok(curr.mtime != prev.mtime);
|
||
15 years ago
|
process.unwatchFile(f);
|
||
15 years ago
|
});
|
||
|
|
||
|
|
||
15 years ago
|
var fs = require("fs");
|
||
15 years ago
|
|
||
15 years ago
|
var fd = fs.openSync(f, "w+");
|
||
|
fs.writeSync(fd, 'xyz\n');
|
||
|
fs.closeSync(fd);
|
||
15 years ago
|
|
||
|
process.addListener("exit", function () {
|
||
15 years ago
|
assert.ok(changes > 0);
|
||
15 years ago
|
});
|