Permalink
Browse files

Change log-tailer to properly track multi-byte characters.

When end-of-line is represented within a file as "\r\n",
it is represented in memory as a single "\n".  This patch eliminates
the discrepancy between size on disk and size in memory.

Signed-off-by: José Valim <jose.valim@gmail.com>
  • Loading branch information...
1 parent 2c8a4a5 commit 1466f312bad35809fa9fe343068d2fc8a814ffe6 Curtis Cablegram committed with josevalim Jul 29, 2010
Showing with 1 addition and 1 deletion.
  1. +1 −1 railties/lib/rails/rack/log_tailer.rb
@@ -24,7 +24,7 @@ def tail!
if mod > @last_checked
contents = @file.read
@last_checked = mod
- @cursor += contents.size
+ @cursor = @file.tell
$stdout.print contents
end
end

0 comments on commit 1466f31

Please sign in to comment.