================
@@ -394,24 +394,25 @@ bool IOHandlerEditline::GetLine(std::string &line, bool
&interrupted) {
if (!got_line && in) {
while (!got_line) {
char *r = fgets(buffer, sizeof(buffer), in);
-#ifdef _WIN32
- // ReadFile on Windows is supposed to set ERROR_OPERATION_ABORTED
- // according to the docs on MSDN. However, this has evidently been a
- // known bug since Windows 8. Therefore, we can't detect if a signal
- // interrupted in the fgets. So pressing ctrl-c causes the repl to end
- // and the process to exit. A temporary workaround is just to attempt to
- // fgets twice until this bug is fixed.
- if (r == nullptr)
- r = fgets(buffer, sizeof(buffer), in);
- // this is the equivalent of EINTR for Windows
- if (r == nullptr && GetLastError() == ERROR_OPERATION_ABORTED)
- continue;
-#endif
if (r == nullptr) {
+ if (feof(in)) {
+ got_line = SplitLineEOF(m_line_buffer);
+ break;
+ }
if (ferror(in) && errno == EINTR)
continue;
----------------
charles-zablit wrote:
That's on purpose: `fgets` is a CRT function. It does not set the
`GetLastError()`. Checking for `ERROR_OPERATION_ABORTED` is incorrect and
checks for a stale value. Checking for `feof` first allows us to break early.
https://github.com/llvm/llvm-project/pull/212745
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits