Skip to content

Commit

Permalink
specify binary mode
Browse files Browse the repository at this point in the history
  • Loading branch information
nurse committed Sep 29, 2015
1 parent 4448361 commit b4726df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/fluent/plugin/out_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ def write(chunk)

case @compress
when nil
File.open(path, "a", DEFAULT_FILE_PERMISSION) {|f|
File.open(path, "ab", DEFAULT_FILE_PERMISSION) {|f|
chunk.write_to(f)
}
when :gz
File.open(path, "a", DEFAULT_FILE_PERMISSION) {|f|
File.open(path, "ab", DEFAULT_FILE_PERMISSION) {|f|
gz = Zlib::GzipWriter.new(f)
chunk.write_to(gz)
gz.close
Expand Down
2 changes: 1 addition & 1 deletion test/plugin/test_out_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def check_gzipped_result(path, expect)
# Zlib::GzipReader has a bug of concatenated file: https://bugs.ruby-lang.org/issues/9790
# Following code from https://www.ruby-forum.com/topic/971591#979520
result = ''
File.open(path) { |io|
File.open(path, "rb") { |io|
loop do
gzr = Zlib::GzipReader.new(io)
result << gzr.read
Expand Down

0 comments on commit b4726df

Please sign in to comment.