summaryrefslogtreecommitdiff
path: root/win32
diff options
context:
space:
mode:
Diffstat (limited to 'win32')
-rw-r--r--win32/win32.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/win32/win32.c b/win32/win32.c
index c4be85b9fe..3b100bf4db 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -6813,10 +6813,13 @@ rb_w32_write_console(uintptr_t strarg, int fd)
len = RSTRING_LEN(str) / sizeof(WCHAR);
break;
}
+ reslen = 0;
while (len > 0) {
long curlen = constat_parse(handle, s, (next = ptr, &next), &len);
+ reslen += next - ptr;
if (curlen > 0) {
- if (!WriteConsoleW(handle, ptr, curlen, &reslen, NULL)) {
+ long written;
+ if (!WriteConsoleW(handle, ptr, curlen, &written, NULL)) {
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
disable = TRUE;
reslen = (DWORD)-1L;