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

Export EOF detection #160

Closed
sunshine69 opened this issue Nov 13, 2019 · 2 comments
Closed

Export EOF detection #160

sunshine69 opened this issue Nov 13, 2019 · 2 comments

Comments

@sunshine69
Copy link

Hi,

In my code I need to detect EOF to do some decisions (basically flush the line stack in multiline parser). However tail does not export the file handle file thus I have to write my own short func to use os.Open the file, seek to the position where tail.Tell() is and try to read one byte to see if I got error is EOF.

This is not efficient I think. In my opinion there should be a better way tail package can export the state for us. Or at least export the file handle so I don't have to call one system os.Open again.

Any ideas to solve it? Or I am missing the doco and not using it right.

Thanks for excellent work and Kind regards

@nxadm
Copy link

nxadm commented Nov 19, 2019

I don't know if this is useful to you, but I merged a PR that exposes SeekInfo information:

https://github.com/nxadm/tail/blob/master/tail.go#L31

Because this repo seems to be dormant for more than a year, I forked it and added the PRs that needed to be merged.

@sunshine69
Copy link
Author

Hi thanks for suggestion but it seems not be useful. The SeekInfo only gives me pos and whence but no way to see if it is an EOF.

however good to know that your repo has better maintained than this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants