1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-03 17:59:28 +02:00
OpenSTF/lib/util/refresh.js

21 lines
375 B
JavaScript

var fs = require('fs')
var watchers = Object.create(null)
function refresh() {
process.kill('SIGHUP')
}
function collect() {
Object.keys(require.cache).forEach(function(path) {
if (!watchers[path]) {
if (path.indexOf('node_modules') === -1) {
watchers[path] = fs.watch(path, refresh)
}
}
})
}
module.exports = function() {
collect()
}