Changeset 20012

Show
Ignore:
Timestamp:
09/27/08 11:23:53 (5 years ago)
Author:
tokuhirom
Message:

bug fixed around Process.GetInheritedIO.

Location:
lang/cplusplus/llv8call/trunk/ext
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • lang/cplusplus/llv8call/trunk/ext/nspr/io.cc

    r19912 r20012  
    1010 
    1111using namespace v8; 
    12  
    13 static inline Handle<Object> nspr_namespace() { 
    14         return Context::GetCurrent()->Global() 
    15                       ->Get(String::New("org"))->ToObject() 
    16                       ->Get(String::New("coderepos"))->ToObject() 
    17                       ->Get(String::New("nspr"))->ToObject(); 
    18 } 
    1912 
    2013static Handle<Value> _Access(const Arguments& args) { 
  • lang/cplusplus/llv8call/trunk/ext/nspr/nspr-v8.h

    r19856 r20012  
    1717} 
    1818 
     19static inline v8::Handle<v8::Object> nspr_namespace() { 
     20        return v8::Context::GetCurrent()->Global() 
     21                      ->Get(v8::String::New("org"))->ToObject() 
     22                      ->Get(v8::String::New("coderepos"))->ToObject() 
     23                      ->Get(v8::String::New("nspr"))->ToObject(); 
     24} 
     25 
  • lang/cplusplus/llv8call/trunk/ext/nspr/process.cc

    r19856 r20012  
    1515    String::Utf8Value name(args[0]->ToString()); 
    1616    PRFileDesc *fd = PR_GetInheritedFD(*name); 
    17     Handle<Function> tmpl = Handle<Function>::Cast(Context::GetCurrent()->Global()->Get(String::New("IO"))); 
     17    Handle<Function> tmpl = Handle<Function>::Cast(nspr_namespace()->Get(String::New("IO"))); 
    1818    Handle<Object> obj = tmpl->NewInstance(); 
    1919    obj->SetInternalField(0, External::New((void*)fd)); 
  • lang/cplusplus/llv8call/trunk/ext/posix/posix.cc

    r19912 r20012  
    33#include <cstring> 
    44#include "v8ext.h" 
    5 #include "llv8-util.h" 
    65#include <unistd.h> 
    76#include <sys/wait.h> 
     7 
     8#define assert_args(args, length) do { if ((args).Length() != (length)) { return v8::ThrowException(v8::String::New("Exception: missing args")); } } while (0) 
    89 
    910using namespace v8; 
    1011 
    1112static Handle<Value> _Fork(const Arguments& args) { 
     13    assert_args(args, 0); 
    1214    return Int32::New(fork()); 
     15} 
     16 
     17static Handle<Value> _sleep(const Arguments& args) { 
     18    assert_args(args, 1); 
     19    sleep(args[0]->Int32Value()); 
     20    return Undefined(); 
    1321} 
    1422 
     
    1927    Handle<Object> target = Object::New(); 
    2028    target->Set(String::New("Fork"), FunctionTemplate::New(_Fork)->GetFunction()); 
     29    target->Set(String::New("Sleep"), FunctionTemplate::New(_sleep)->GetFunction()); 
    2130    return target; 
    2231}