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

scope.Close in GuessHandleType; don't use uv_is_tty

  • Loading branch information...
ry committed Sep 23, 2011
1 parent 0c4a424 commit 9f879ce523350c04b4ab978d8852ecd61f200031
Showing with 6 additions and 8 deletions.
  1. +2 −2 src/node.js
  2. +4 −6 src/tty_wrap.cc
@@ -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();

@@ -69,27 +69,25 @@ 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<Value> IsTTY(const Arguments& args) {
HandleScope scope;
int fd = args[0]->Int32Value();
assert(fd >= 0);
return uv_is_tty(fd) ? v8::True() : v8::False();
return uv_guess_handle(fd) == UV_TTY ? v8::True() : v8::False();
}

static Handle<Value> GetWindowSize(const Arguments& args) {

0 comments on commit 9f879ce

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