Fix #6. Handle Ctrl-D in REPL.

This commit is contained in:
Bob Nystrom
2014-01-21 15:41:07 -08:00
parent 74d045540b
commit a4162a2eb3

View File

@ -69,6 +69,13 @@ static int runRepl(WrenVM* vm)
char line[MAX_LINE];
fgets(line, MAX_LINE, stdin);
// If stdin was closed (usually meaning the used entered Ctrl-D), exit.
if (feof(stdin))
{
printf("\n");
return 0;
}
// TODO: Handle failure.
wrenInterpret(vm, "(repl)", line);
// TODO: Figure out how this should work with wren API.