Modifies readline() to behave in the same way as it does in TraceMonkey.

Author: abdulla <abdulla.kamar@gmail.com>
Review URL: http://codereview.chromium.org/173262


git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@2838 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f7c799f0
......@@ -179,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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment