|
@ -1,23 +1,25 @@ |
|
|
process.mixin(require("./common")); |
|
|
process.mixin(require("./common")); |
|
|
|
|
|
|
|
|
var posix = require("posix"); |
|
|
|
|
|
var path = require("path"); |
|
|
var path = require("path"); |
|
|
|
|
|
|
|
|
var f = path.join(fixturesDir, "x.txt"); |
|
|
var f = path.join(fixturesDir, "x.txt"); |
|
|
var f2 = path.join(fixturesDir, "x2.txt"); |
|
|
var f2 = path.join(fixturesDir, "x2.txt"); |
|
|
|
|
|
|
|
|
|
|
|
puts("watching for changes of " + f); |
|
|
|
|
|
|
|
|
var changes = 0; |
|
|
var changes = 0; |
|
|
process.watchFile(f, function () { |
|
|
process.watchFile(f, function () { |
|
|
puts(f + " change"); |
|
|
puts(f + " change"); |
|
|
changes++; |
|
|
changes++; |
|
|
|
|
|
process.unwatchFile(f); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
setTimeout(function () { |
|
|
var File = require("file").File; |
|
|
posix.rename(f, f2).wait(); |
|
|
|
|
|
posix.rename(f2, f).wait(); |
|
|
var file = new File(f, 'w+'); |
|
|
process.unwatchFile(f); |
|
|
file.write('xyz\n'); |
|
|
}, 10); |
|
|
file.close().wait(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
process.addListener("exit", function () { |
|
|
process.addListener("exit", function () { |
|
|