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.
29 lines
777 B
JavaScript
29 lines
777 B
JavaScript
var common = require('../common');
|
|
var assert = require('assert');
|
|
var path = require('path');
|
|
var fs = require('fs');
|
|
|
|
var testDir = common.tmpDir;
|
|
var testsubdir = path.join(testDir, 'testsubdir');
|
|
var filepath = path.join(testsubdir, 'watch.txt');
|
|
|
|
function cleanup() {
|
|
try { fs.unlinkSync(filepath); } catch (e) { }
|
|
try { fs.rmdirSync(testsubdir); } catch (e) { }
|
|
}
|
|
process.on('exit', cleanup);
|
|
cleanup();
|
|
|
|
try { fs.mkdirSync(testsubdir, 0700); } catch (e) {}
|
|
|
|
// Need a grace period, else the mkdirSync() above fires off an event.
|
|
setTimeout(function() {
|
|
var watcher = fs.watch(testDir, { persistent: true }, assert.fail);
|
|
setTimeout(function() {
|
|
fs.writeFileSync(filepath, 'test');
|
|
}, 100);
|
|
setTimeout(function() {
|
|
watcher.close();
|
|
}, 500);
|
|
}, 50);
|