hpcloud / tail

Go package for reading from continously updated files (tail -f)
MIT License
2.71k stars 503 forks source link

Nulls in line.Text #102

Closed davidsturman closed 7 years ago

davidsturman commented 7 years ago

I'm trying this out on Windows, and everything seems to be working out of the box except I'm getting a NUL character between every character that's printed out.

Here's the code: t, err := tail.TailFile("foo", tail.Config{Follow: true, Logger: tail.DiscardingLogger}) if err != nil { log.Fatal(err) return } for line := range t.Lines { fmt.Println(line.Text) }

Any idea why this is happening?

davidsturman commented 7 years ago

Found the problem. I was testing it using the Windows command "echo 'abcd' >> tailing_file" Windows seems to put in NULs when tail has the file open. Appending to the file with another go program worked fine.