Skip to content

Commit

Permalink
Make out_file append option work without compression
Browse files Browse the repository at this point in the history
For Ruby 2.7.x and 3.0.x, out_file append option without compression
does not work. The cause is the following Ruby language bug:

https://bugs.ruby-lang.org/issues/18388.

This commit is a workaround for this problem.

See #3569.
  • Loading branch information
yaojingguo committed Dec 21, 2021
1 parent 85ff1a3 commit 2bd634c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/fluent/plugin/out_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,12 @@ def write(chunk)

def write_without_compression(path, chunk)
File.open(path, "ab", @file_perm) do |f|
chunk.write_to(f)
if @append
content = chunk.read()
f.puts content
else
chunk.write_to(f)
end
end
end

Expand Down

0 comments on commit 2bd634c

Please sign in to comment.