Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

Support legacy API: process.stdout.fd

  • Loading branch information...
ry committed Sep 15, 2011
1 parent 5cb1fd2 commit b2811710303bfaac92087b02b278a6effae39e4a
Showing with 12 additions and 0 deletions.
  1. +9 −0 src/node.js
  2. +3 −0 test/simple/test-console.js
@@ -251,6 +251,9 @@
stdout._type = "pipe";
}

// For supporting legacy API we put the FD here.
stdout.fd = fd;

return stdout;
});

@@ -259,6 +262,9 @@
stderr.readable = false;
stderr.write = process.binding('stdio').writeError;
stderr.end = stderr.destroy = stderr.destroySoon = function() { };
// For supporting legacy API we put the FD here.
// XXX this could break things if anyone ever closes this stream?
stderr.fd = 2;

process.__defineGetter__('stdin', function() {
if (stdin) return stdin;
@@ -278,6 +284,9 @@
stdin.readable = true;
}

// For supporting legacy API we put the FD here.
stdin.fd = fd;

return stdin;
});

@@ -27,6 +27,9 @@ var assert = require('assert');

assert.ok(process.stdout.writable);
assert.ok(process.stderr.writable);
// Support legacy API
assert.equal('number', typeof process.stdout.fd);
assert.equal('number', typeof process.stderr.fd);


var stdout_write = global.process.stdout.write;

0 comments on commit b281171

Please sign in to comment.
You can’t perform that action at this time.