Closed larsbrinkhoff closed 7 years ago
Hmm. There appears to be no way to distinguish EOF from an empty line in jsc.cpp:
2336 EncodedJSValue JSC_HOST_CALL functionReadline(ExecState* exec)
2337 {
2338 Vector<char, 256> line;
2339 int c;
2340 while ((c = getchar()) != EOF) {
2341 // FIXME: Should we also break on \r?
2342 if (c == '\n')
2343 break;
2344 line.append(c);
2345 }
2346 line.append('\0');
2347 return JSValue::encode(jsString(exec, line.data()));
2348 }
Merged without the tests.
Seems to work quite well, except for one thing:
readline
doesn't seem to detect EOF when reading from a pipe. So the tests just hang when they reach the end of the input file.