Skip to content

Commit cb30520

Browse files
committed
check for interrupt from fgets on Windows
Windows does not have the error EINTR when a blocking syscall is interrupted by a signal. The ReadFile API that fgets is implemented with instead use ERROR_OPERATION_ABORTED. Check for that after fgets. llvm-svn: 366520
1 parent bb08969 commit cb30520

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lldb/source/Core/IOHandler.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@ bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
383383
// fgets twice until this bug is fixed.
384384
if (fgets(buffer, sizeof(buffer), in) == nullptr &&
385385
fgets(buffer, sizeof(buffer), in) == nullptr) {
386+
// this is the equivalent of EINTR for Windows
387+
if (GetLastError() == ERROR_OPERATION_ABORTED)
388+
continue;
386389
#else
387390
if (fgets(buffer, sizeof(buffer), in) == nullptr) {
388391
#endif

0 commit comments

Comments
 (0)