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

Issue on reopen deleted file #57

Closed
smartwang opened this issue Jul 23, 2015 · 0 comments
Closed

Issue on reopen deleted file #57

smartwang opened this issue Jul 23, 2015 · 0 comments

Comments

@smartwang
Copy link

os: centos 7
Repeat steps:

touch /tmp/test.log
cat tail.go

package main
import (
    "github.com/ActiveState/tail"
    "log"
)

func main() {
    t, err := tail.TailFile("/tmp/test.log", tail.Config{Follow:true, ReOpen:true})
    if err != nil {
        log.Panic(err)
    }
    for line := range t.Lines {
        log.Printf(line.Text)
    }
}

go run tail.go &
rm /tmp/test.log
touch /tmp/test.log
echo "111" >> /tmp/test.log

you can see tail.go failed to reopen /tmp/test.log, because /tmp/test.log is already opened by tail.go,rm didn't really delete this file.

davidsansome added a commit to davidsansome/tail that referenced this issue Oct 1, 2015
inotify works on the inode, not the path.  Deleting the file doesn't
touch the inode, so doesn't generate an event on the file.

Fixes hpcloud#57
@Nino-K Nino-K closed this as completed in e681532 Apr 26, 2016
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