Closed dressupgeekout closed 2 weeks ago
This fix behaves like typing quit
at the dingusdbg>
prompt. Without this fix, the dingusdbg>
prompt gets output in an endless loop if the user types Control-D at the prompt.
I think the feof(stdin)
check should be moved to before the cmd_repeat = cmd.empty() && !last_cmd.empty();
statement like this:
if (feof(stdin)) {
printf("eof -> quit\n");
cmd = "quit";
}
because feof(stdin)
causes ss >> cmd
to be empty which causes the last command to be repeated (if it was a command that is repeatable, such as si
).
The fix was added with dingusdev/dingusppc@c0e28b81a8a2ab193e72a361bfe714153e3f1b6e
Typing "quit" isn't the only way to leave the REPL. This change prevents the REPL from spiralling in an endless loop when you hit ^D in the terminal.
Maybe there's a more C++-esque way of expressing what I'm trying to do here -- it works as expected on Linux, at least.