diff --git a/src/node.js b/src/node.js index 334c4eb422..bc4bd56c60 100644 --- a/src/node.js +++ b/src/node.js @@ -108,10 +108,10 @@ } else { var binding = process.binding('stdio'); - var fd = binding.openStdin(); var Module = NativeModule.require('module'); - if (NativeModule.require('tty').isatty(fd)) { + // If stdin is a TTY. + if (NativeModule.require('tty').isatty(0)) { // REPL Module.requireRepl().start(); diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index 9eceb82528..e172965136 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -69,20 +69,18 @@ class TTYWrap : StreamWrap { switch (t) { case UV_TTY: - return String::New("TTY"); + return scope.Close(String::New("TTY")); case UV_NAMED_PIPE: - return String::New("PIPE"); + return scope.Close(String::New("PIPE")); case UV_FILE: - return String::New("FILE"); + return scope.Close(String::New("FILE")); default: assert(0); return v8::Undefined(); } - return uv_is_tty(fd) ? v8::True() : v8::False(); - } static Handle IsTTY(const Arguments& args) {