0
我
有这个脚本,手表在目录中的文件咕噜任务退出得早
// the_script.js
var fs = require('fs');
fs.watch('someDir', function() {
console.log('I see you');
});
我运行它与
node the_script.js
并正确保持运行下去。
现在,我想使它成为一个繁重的任务,但如果我写的任务,因为
// Gruntfile.js
module.exports = function(grunt) {
grunt.registerTask('default', function(grunt) {
console.log('loading task');
var fs = require('fs');
fs.watch('someDir', function() {
console.log('I see you');
});
});
};
当我运行
grunt
我只看到“装载任务”,比进程退出。
我想知道如何让咕噜声的任务永远运行,并了解发生了什么。