public
Last active

figure out what is trying to write to a stream in node

  • Download Gist
output.txt
1 2 3 4 5 6 7 8 9 10 11
Trace
at WriteStream.process.stdout.write (/Users/dave/dev/node-latest/index.js:4:11)
at Object.exports.log (console.js:25:18)
at Object.keys.forEach.console.(anonymous function) [as log] (/Users/dave/dev/node-latest/node_modules/log-timestamp/index.js:13:14)
at defaultCb (/Users/dave/dev/node-latest/node_modules/npm/lib/npm.js:205:16)
at Conf.done (/Users/dave/dev/node-latest/node_modules/npm/node_modules/npmconf/npmconf.js:218:15)
at Object.oncomplete (fs.js:297:15)
undefined
 
 
... and find out the npm module is firing a default callback because I didn't supply one, that logs to stdout.
streamsnoop.js
JavaScript
1 2 3 4 5 6 7 8 9
/**
* overwrite the process.stdout.write function to call console.trace first
*/
 
var a = process.stdout.write;
process.stdout.write = function() {
console.trace();
a.apply(this, arguments);
};

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.