aboutsummaryrefslogtreecommitdiffstats
path: root/win32/win32.c
diff options
context:
space:
mode:
Diffstat (limited to 'win32/win32.c')
-rw-r--r--win32/win32.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/win32/win32.c b/win32/win32.c
index 6637dcb9e3..f55fe9c278 100644
--- a/win32/win32.c
+++ b/win32/win32.c
@@ -5296,15 +5296,16 @@ rb_w32_write_console(VALUE str, int fd)
if (disable) return -1L;
handle = (HANDLE)_osfhnd(fd);
if (!GetConsoleMode(handle, &dwMode) ||
- !rb_econv_has_convpath_p(rb_enc_name(rb_enc_get(str)), "UTF-16LE"))
- return -1L;
+ !rb_econv_has_convpath_p(rb_enc_name(rb_enc_get(str)), "UTF-16LE"))
+ return -1L;
str = rb_str_encode(str, rb_enc_from_encoding(rb_enc_find("UTF-16LE")), 0,
- Qnil);
- if (!WriteConsoleW(handle, (LPWSTR)RSTRING_PTR(str), RSTRING_LEN(str)/2, &reslen, NULL)) {
- if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
- disable = TRUE;
- return -1L;
+ Qnil);
+ if (!WriteConsoleW(handle, (LPWSTR)RSTRING_PTR(str), RSTRING_LEN(str)/2,
+ &reslen, NULL)) {
+ if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED)
+ disable = TRUE;
+ return -1L;
}
return (long)reslen;
}