Skip to content

Commit

Permalink
FileWrapper::WindowsFile: Support encoding parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Takuro Ashie <[email protected]>
  • Loading branch information
ashie committed Sep 1, 2022
1 parent ac6a491 commit 918e478
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/fluent/file_wrapper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,11 @@ class WindowsFile

INVALID_HANDLE_VALUE = -1

def initialize(path, mode='r')
def initialize(path, mode_enc='r')
@path = path
mode, enc = mode_enc.split(":", 2)
@io = File.open(path, mode2flags(mode))
@io.set_encoding(enc) if enc
@file_handle = Win32API._get_osfhandle(@io.to_i)
@io.instance_variable_set(:@file_index, self.ino)
def @io.ino
Expand Down

0 comments on commit 918e478

Please sign in to comment.