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 testWritten by Johannes Boyne
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Automation
Authors
Did you know?
JavaScript on a page runs with the privileges of that origin. One altered library, tag manager, or snippet can read inputs, change what people see, and call your APIs as the user.
Security insights from Cside
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#