Skip to content

Instantly share code, notes, and snippets.

@tsujigiri
Created December 12, 2013 16:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsujigiri/7930590 to your computer and use it in GitHub Desktop.
Save tsujigiri/7930590 to your computer and use it in GitHub Desktop.
`tail -f` a file and process it line by line in Ruby
IO.popen("tail -F -n 0 #{path}") do |file|
while true
line = file.readline
# do stuff with line
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment