Skip to content

Commit

Permalink
Merge pull request #101 from masterzen/bugfix/100-allow-to-tail-named…
Browse files Browse the repository at this point in the history
…-pipe

Fix #100 allowing to tail named pipes
  • Loading branch information
jwilder authored Mar 20, 2018
2 parents 0ac1242 + 0400d2c commit d79aba5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions tail.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,18 @@ import (

func tailFile(ctx context.Context, file string, poll bool, dest *os.File) {
defer wg.Done()

s, err := os.Stat(file)
if err != nil {
log.Fatalf("unable to stat %s: %s", file, err)
}

t, err := tail.TailFile(file, tail.Config{
Follow: true,
ReOpen: true,
Poll: poll,
Logger: tail.DiscardingLogger,
Pipe: s.Mode()&os.ModeNamedPipe != 0,
})
if err != nil {
log.Fatalf("unable to tail %s: %s", file, err)
Expand Down

0 comments on commit d79aba5

Please sign in to comment.