Skip to content

Instantly share code, notes, and snippets.

@lancejpollard
Created August 15, 2010 18:43
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save lancejpollard/525804 to your computer and use it in GitHub Desktop.
Save lancejpollard/525804 to your computer and use it in GitHub Desktop.
// http://nodejs.org/api.html#_child_processes
var sys = require('sys')
var spawn = require('child_process').spawn;
var filename = process.ARGV[2];
if (!filename)
return sys.puts("Usage: node <server.js> <filename>");
var tail = spawn("tail", ["-f", filename]);
sys.puts("start tailing");
tail.stdout.on("data", function (data) {
sys.puts(data);
});
// node tail.js development.log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment