diff --git a/.gitignore b/.gitignore index bac9a1f..0608beb 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ coverage .yardoc .ruby-version pkg/* +.idea diff --git a/lib/fluent/plugin/named_pipe/fifo.rb b/lib/fluent/plugin/named_pipe/fifo.rb index d28a4dd..922a753 100644 --- a/lib/fluent/plugin/named_pipe/fifo.rb +++ b/lib/fluent/plugin/named_pipe/fifo.rb @@ -31,6 +31,12 @@ def open end def readline + if nil != (idx = @buf.index("\n")) + line = @buf[0, idx + 1] + @buf = @buf[idx + 1, @buf.length - line.length] + return line + end + res = IO.select([@pipe], [], [], READ_TIMEOUT) return nil if res.nil?