From bc23ec8d05692aead3e227a8d4224569c6401fb9 Mon Sep 17 00:00:00 2001 From: Ryan Dahl Date: Thu, 3 Feb 2011 14:03:44 -0800 Subject: [PATCH] Add process.stderr stream --- doc/api/process.markdown | 5 +++++ src/node.js | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/doc/api/process.markdown b/doc/api/process.markdown index 9594d1a520..ca65f3e5d4 100644 --- a/doc/api/process.markdown +++ b/doc/api/process.markdown @@ -81,6 +81,11 @@ Example: the definition of `console.log` }; +### process.stderr + +A writable stream to stderr. Writes on this stream are blocking. + + ### process.stdin A `Readable Stream` for stdin. The stdin stream is paused by default, so one diff --git a/src/node.js b/src/node.js index 0b87289572..3841efb12d 100644 --- a/src/node.js +++ b/src/node.js @@ -153,6 +153,14 @@ return stdout; }); + var stderr = process.stderr = { + writable: true, + readable: false, + write: process.binding('stdio').writeError + }; + + stderr.end = stderr.destroy = stderr.destroySoon = function() { }; + process.__defineGetter__('stdin', function() { if (stdin) return stdin;