Skip to content

Instantly share code, notes, and snippets.

@pguillory
pguillory / gist:729616
Created Dec 5, 2010
Hooking into Node.js stdout
View gist:729616
var util = require('util')
function hook_stdout(callback) {
var old_write = process.stdout.write
process.stdout.write = (function(write) {
return function(string, encoding, fd) {
write.apply(process.stdout, arguments)
callback(string, encoding, fd)
}