mirror of
https://github.com/wren-lang/wren.git
synced 2026-01-11 22:28:45 +01:00
Change IO.read to return null on EOF
This commit is contained in:
@ -120,11 +120,9 @@ static void ioRead(WrenVM* vm)
|
||||
char buffer[MAX_READ_LEN];
|
||||
char* result = fgets(buffer, MAX_READ_LEN, stdin);
|
||||
|
||||
if (result == NULL) {
|
||||
// TODO: handle error.
|
||||
if (result != NULL) {
|
||||
wrenReturnString(vm, buffer, (int)strlen(buffer));
|
||||
}
|
||||
|
||||
wrenReturnString(vm, buffer, (int)strlen(buffer));
|
||||
}
|
||||
|
||||
static void ioClock(WrenVM* vm)
|
||||
|
||||
1
test/io/read_eof.wren
Normal file
1
test/io/read_eof.wren
Normal file
@ -0,0 +1 @@
|
||||
IO.write(IO.read) // expect: null
|
||||
Reference in New Issue
Block a user