diff options
author | Ryan <ry@tinyclouds.org> | 2009-09-09 22:01:54 +0200 |
---|---|---|
committer | Ryan <ry@tinyclouds.org> | 2009-09-09 22:01:54 +0200 |
commit | fcff66bf29fef8a9d568ebb4cb7192ab32afe3f7 (patch) | |
tree | 8ea321ed7f248a54403d86154d4df325960d41ef /deps/v8/src/d8.cc | |
parent | efb2b703a655b29a692819c8bdb191792da6416e (diff) | |
download | node-new-fcff66bf29fef8a9d568ebb4cb7192ab32afe3f7.tar.gz |
Upgrade v8 to 1.3.10
Diffstat (limited to 'deps/v8/src/d8.cc')
-rw-r--r-- | deps/v8/src/d8.cc | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/deps/v8/src/d8.cc b/deps/v8/src/d8.cc index 7082280856..e4658b1cee 100644 --- a/deps/v8/src/d8.cc +++ b/deps/v8/src/d8.cc @@ -159,8 +159,7 @@ Handle<Value> Shell::Write(const Arguments& args) { printf(" "); } v8::String::Utf8Value str(args[i]); - const char* cstr = ToCString(str); - printf("%s", cstr); + fwrite(*str, sizeof(**str), str.length(), stdout); } return Undefined(); } @@ -180,15 +179,15 @@ Handle<Value> Shell::Read(const Arguments& args) { Handle<Value> Shell::ReadLine(const Arguments& args) { - char line_buf[256]; - if (fgets(line_buf, sizeof(line_buf), stdin) == NULL) { - return ThrowException(String::New("Error reading line")); + i::SmartPointer<char> line(i::ReadLine("")); + if (*line == NULL) { + return Null(); } - int len = strlen(line_buf); - if (line_buf[len - 1] == '\n') { + size_t len = strlen(*line); + if (len > 0 && line[len - 1] == '\n') { --len; } - return String::New(line_buf, len); + return String::New(*line, len); } |