Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added tail UNIX like functionality #3038

Closed
wants to merge 1 commit into from

Conversation

puppetpies
Copy link

Added tail function with delay that accepts block.

@lbguilherme
Copy link
Contributor

lbguilherme commented Jul 24, 2016

What are the usecases for this? Not sure if it should be in the standard library.

And also, this implementation could be alot improved on performance. It should open the file just once, move to the end of file and try to read periodically until it does not read EOF. Also, only sleep if there is nothing more to read. The way you did it works, but will be extremely slow when the file is huge.

inotify could be used on systems that support it to avoid the sleep.

A better name would be follow_tail. Simply tail makes me think it returns the last N lines and done.

@asterite
Copy link
Member

@lbguilherme My thoughts exactly

I can imagine tail as a command line application, but I don't know when this would be useful as a method to use in a program. And, in any case, it can be provided as a separate shard.

(which already exists: https://github.com/Thor77/tail.cr)

@puppetpies puppetpies closed this Jul 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants