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.

Signed-off-by: Jingguo Yao <yaojingguo@gmail.com>
  • Loading branch information
yaojingguo committed Dec 22, 2021
1 parent 85ff1a3 commit a61c1e3
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion lib/fluent/plugin/out_file.rb
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 a61c1e3

Please sign in to comment.