From bf05b643d969c727303e7c4ff86c465375330f8b Mon Sep 17 00:00:00 2001 From: Jan Biedermann Date: Fri, 14 May 2021 12:19:19 +0200 Subject: [PATCH] Repair writing of unicode strings, send complete string. --- lib/win32/pipe.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/win32/pipe.rb b/lib/win32/pipe.rb index 3c876ba..44707ce 100644 --- a/lib/win32/pipe.rb +++ b/lib/win32/pipe.rb @@ -182,7 +182,7 @@ def write(data) raise Error, "no pipe created" unless @pipe if @asynchronous - bool = WriteFile(@pipe, data, data.size, bytes, @overlapped) + bool = WriteFile(@pipe, data, data.bytesize, bytes, @overlapped) bytes_written = bytes.read_ulong if bool && bytes_written > 0 @@ -198,7 +198,7 @@ def write(data) return false else - unless WriteFile(@pipe, data, data.size, bytes, nil) + unless WriteFile(@pipe, data, data.bytesize, bytes, nil) raise SystemCallError.new("WriteFile", FFI.errno) end