Skip to content

Commit 50e5c54

Browse files
committed
Win32: Remove the workaround for console reading bug
It has been fixed at Windows 8, and we already have dropped the support Windows 8 and olders.
1 parent 04494d9 commit 50e5c54

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

win32/win32.c

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -7223,9 +7223,6 @@ rb_w32_read_internal(int fd, void *buf, size_t size, rb_off_t *offset)
72237223
size_t len;
72247224
size_t ret;
72257225
OVERLAPPED ol;
7226-
BOOL isconsole;
7227-
BOOL islineinput = FALSE;
7228-
int start = 0;
72297226

72307227
if (is_socket(sock))
72317228
return rb_w32_recv(fd, buf, size, 0);
@@ -7248,25 +7245,8 @@ rb_w32_read_internal(int fd, void *buf, size_t size, rb_off_t *offset)
72487245
}
72497246

72507247
ret = 0;
7251-
isconsole = is_console(_osfhnd(fd)) && (osver.dwMajorVersion < 6 || (osver.dwMajorVersion == 6 && osver.dwMinorVersion < 2));
7252-
if (isconsole) {
7253-
DWORD mode;
7254-
GetConsoleMode((HANDLE)_osfhnd(fd),&mode);
7255-
islineinput = (mode & ENABLE_LINE_INPUT) != 0;
7256-
}
72577248
retry:
7258-
/* get rid of console reading bug */
7259-
if (isconsole) {
7260-
constat_reset((HANDLE)_osfhnd(fd));
7261-
if (start)
7262-
len = 1;
7263-
else {
7264-
len = 0;
7265-
start = 1;
7266-
}
7267-
}
7268-
else
7269-
len = size;
7249+
len = size;
72707250
size -= len;
72717251

72727252
if (setup_overlapped(&ol, fd, FALSE, offset)) {
@@ -7337,8 +7317,7 @@ rb_w32_read_internal(int fd, void *buf, size_t size, rb_off_t *offset)
73377317
ret += read;
73387318
if (read >= len) {
73397319
buf = (char *)buf + read;
7340-
if (err != ERROR_OPERATION_ABORTED &&
7341-
!(isconsole && len == 1 && (!islineinput || *((char *)buf - 1) == '\n')) && size > 0)
7320+
if (err != ERROR_OPERATION_ABORTED && size > 0)
73427321
goto retry;
73437322
}
73447323
if (read == 0)

0 commit comments

Comments
 (0)