[PATCH] D64660: add a workaround in GetLine to account for ReadFile not reporintg error

Nathan Lanza via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 16 16:01:40 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL366281: add a workaround in GetLine to account for ReadFile not reporintg error (authored by lanza, committed by ).
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64660/new/

https://reviews.llvm.org/D64660

Files:
  lldb/trunk/source/Core/IOHandler.cpp


Index: lldb/trunk/source/Core/IOHandler.cpp
===================================================================
--- lldb/trunk/source/Core/IOHandler.cpp
+++ lldb/trunk/source/Core/IOHandler.cpp
@@ -374,7 +374,18 @@
       bool got_line = false;
       m_editing = true;
       while (!done) {
+#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 (fgets(buffer, sizeof(buffer), in) == nullptr &&
+            fgets(buffer, sizeof(buffer), in) == nullptr) {
+#else
         if (fgets(buffer, sizeof(buffer), in) == nullptr) {
+#endif
           const int saved_errno = errno;
           if (feof(in))
             done = true;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64660.210212.patch
Type: text/x-patch
Size: 1041 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190716/a58d0f3c/attachment.bin>


More information about the llvm-commits mailing list