Browse Source

Add isatty for isaacs

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
2629296c25
  1. 13
      src/node_stdio.cc

13
src/node_stdio.cc

@ -104,6 +104,18 @@ static Handle<Value> GetRows (const Arguments& args) {
return scope.Close(Integer::NewFromUnsigned(ws.ws_row)); return scope.Close(Integer::NewFromUnsigned(ws.ws_row));
} }
static Handle<Value> IsATTY (const Arguments& args) {
HandleScope scope;
int fd = args[0]->IntegerValue();
int r = isatty(fd);
return scope.Close(r ? True() : False());
}
/* STDERR IS ALWAY SYNC ALWAYS UTF8 */ /* STDERR IS ALWAY SYNC ALWAYS UTF8 */
static Handle<Value> static Handle<Value>
WriteError (const Arguments& args) WriteError (const Arguments& args)
@ -219,6 +231,7 @@ void Stdio::Initialize(v8::Handle<v8::Object> target) {
NODE_SET_METHOD(target, "setRawMode", SetRawMode); NODE_SET_METHOD(target, "setRawMode", SetRawMode);
NODE_SET_METHOD(target, "getColumns", GetColumns); NODE_SET_METHOD(target, "getColumns", GetColumns);
NODE_SET_METHOD(target, "getRows", GetRows); NODE_SET_METHOD(target, "getRows", GetRows);
NODE_SET_METHOD(target, "isatty", IsATTY);
struct sigaction sa = {0}; struct sigaction sa = {0};
sa.sa_handler = HandleSIGCONT; sa.sa_handler = HandleSIGCONT;

Loading…
Cancel
Save