Skip to content

Tailing a non-existent file causes the first line to be dropped #11

Open
@insasho

Description

@insasho

Steps to repeat:
Write a simple Tail client in the fashion of:

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

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

Then, run the program (go run .../test.go). In another window, run echo line1 > /tmp/log and then echo line2 >> /tmp/log.

Expected result:
The Go program should print out two lines, line1 and line2.

Actual result:
The Go program only prints out one line.

Platform:
Linux maw 3.8.0-26-generic #38-Ubuntu SMP Mon Jun 17 21:43:33 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions