Created
June 12, 2011 18:26
-
-
Save c4milo/1021850 to your computer and use it in GitHub Desktop.
testing issue #17
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
camilo@ubuntu:~/Development/inotify$ node test2.js | |
1 'node_modules/inotify' | |
2 'node_modules/walk' | |
3 'node_modules/walk/old' | |
4 'node_modules/walk/profile' | |
5 'node_modules/walk/node_modules' | |
6 'node_modules/walk/examples' | |
7 'node_modules/walk/lib' | |
8 'node_modules/walk/node_modules/futures' | |
9 'node_modules/walk/node_modules/futures/node_modules' | |
10 'node_modules/walk/node_modules/futures/node_modules/.bin' | |
11 'node_modules/walk/node_modules/futures/node_modules/require-kiss' | |
hello yo | |
12 'node_modules/walk/old/examples' | |
13 'node_modules/walk/old/lib' | |
hello yo | |
14 'node_modules/inotify/build' | |
15 'node_modules/inotify/src' | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
16 'node_modules/inotify/build/.conf_check_0' | |
17 'node_modules/inotify/build/default' | |
18 'node_modules/inotify/build/c4che' | |
19 'node_modules/inotify/build/default/src' | |
20 'node_modules/inotify/build/.conf_check_0/testbuild' | |
21 'node_modules/inotify/build/.conf_check_0/testbuild/default' | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo | |
hello yo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var sys = require('sys'), | |
fs = require('fs'), | |
walk = require('walk'), | |
exec = require('child_process').exec, | |
Inotify = require('inotify').Inotify; | |
var inotify = new Inotify(); | |
exports.watchDirectory = function(path, command){ | |
var wd = inotify.addWatch({ | |
path: path, | |
watch_for: Inotify.IN_MODIFY | |
| Inotify.IN_OPEN | |
| Inotify.IN_CLOSE_NOWRITE | |
| Inotify.IN_CLOSE_WRITE | |
| Inotify.IN_MOVE | |
| Inotify.IN_CREATE | |
| Inotify.IN_DELETE | |
| Inotify.IN_DELETE_SELF | |
| Inotify.IN_MOVE_SELF, | |
callback: function(event){ | |
exec(command, function puts(error, stdout, stderr) { | |
sys.puts(stdout); | |
}); | |
} | |
}); | |
console.log(wd, path); | |
}; | |
exports.watchDirectories = function(path, command){ | |
var walker = walk.walk(path, {followLinks: false}); | |
walker.on('directories', function(root, stat, next){ | |
stat.forEach(function(st){ | |
exports.watchDirectory(root + '/' + st.name, command); | |
}); | |
next(); | |
}); | |
}; | |
exports.watchDirectories('node_modules', 'echo "hello yo"'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment