Return to Snippet

Revision: 30505
at August 16, 2010 04:43 by viatropos


Initial Code
// 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

Initial URL
tail-log-output-with-node-js

Initial Description

                                

Initial Title
Tail Log Output with Node.js

Initial Tags
unix, log

Initial Language
JavaScript