forked from OSchip/llvm-project
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
This commit is contained in:
parent
bb0896970a
commit
cb30520555
|
@ -383,6 +383,9 @@ bool IOHandlerEditline::GetLine(std::string &line, bool &interrupted) {
|
|||
// fgets twice until this bug is fixed.
|
||||
if (fgets(buffer, sizeof(buffer), in) == nullptr &&
|
||||
fgets(buffer, sizeof(buffer), in) == nullptr) {
|
||||
// this is the equivalent of EINTR for Windows
|
||||
if (GetLastError() == ERROR_OPERATION_ABORTED)
|
||||
continue;
|
||||
#else
|
||||
if (fgets(buffer, sizeof(buffer), in) == nullptr) {
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue