Skip to content

Commit

Permalink
WIP: Use File::Constants::SHARE_DELETE instead of FileWrapper
Browse files Browse the repository at this point in the history
Signed-off-by: Takuro Ashie <[email protected]>
  • Loading branch information
ashie committed May 30, 2022
1 parent ddf0c3d commit d565510
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/fluent/plugin/in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1117,7 +1117,7 @@ def handle_notify
end

def open
io = Fluent::FileWrapper.open(@path)
io = File.open(@path, File::Constants::RDWR | File::Constants::BINARY | File::Constants::SHARE_DELETE)
io.seek(@watcher.pe.read_pos + @fifo.bytesize)
@metrics.opened.inc
io
Expand Down
2 changes: 1 addition & 1 deletion test/plugin/test_in_tail.rb
Original file line number Diff line number Diff line change
Expand Up @@ -999,7 +999,7 @@ def test_rotate_file_with_write_old_and_no_new_file(data)
end

def sub_test_rotate_file(config = nil, expect_emits: nil, expect_records: nil, timeout: nil)
file = Fluent::FileWrapper.open("#{TMP_DIR}/tail.txt", "wb")
file = File.open("#{TMP_DIR}/tail.txt", File::Constants::WRONLY | File::Constants::CREAT | File::Constants::TRUNC | File::Constants::BINARY | File::Constants::SHARE_DELETE)
file.puts "test1"
file.puts "test2"
file.flush
Expand Down

0 comments on commit d565510

Please sign in to comment.