watch + make with node.js
watch is great but here is a solution for the nodejs fan-boys (like I am):
#!/usr/bin/env node
var fs = require('fs');
fs.watch(process.argv[2], function (fsWatch) {
var spawn = require('child_process').spawn,
pro = spawn(process.argv[3], [process.argv[4]]);
pro.stdout.on('data', function (data) {
console.log('(log): ' + data);
});
pro.stderr.on('data', function (data) {
console.log('(error): ' + data);
});
});
use it like this:
$ ./watch.js text.txt make test
Written by Johannes Boyne
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Automation
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#