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

waiting for file to appear doesn't appear if file isn't closed #164

Open
ailisp opened this issue Dec 20, 2019 · 0 comments
Open

waiting for file to appear doesn't appear if file isn't closed #164

ailisp opened this issue Dec 20, 2019 · 0 comments

Comments

@ailisp
Copy link

ailisp commented Dec 20, 2019

When doing this on an inexist file:

tail.TailFile(outputFilename, tail.Config{
			Follow: true, ReOpen: true, MustExist: false,
})

It logs waiting for file to appear. If i create the file now in a text editor, enter some lines and save, tail correctly detect there are new lines. However, if the file is created by another program and not closed, for example, this python script:

with open(outputFilename, 'w') as f:
    for i in range(100):
        f.write(str(i))
        f.write('\n')
        f.flush()
        time.sleep(1)

Then the tail doesn't detect file exist before the file is closed. But the file content does changed before it's closed. I can verify by 1) open the file in a text editor; or 2) rerun the go tail program, this time it can watch the file line by line.

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

1 participant