Closed maxkueng closed 11 years ago
ha. awesome tests/examples thanks ill fix this.
its interesting. all of my test cases create watchers before creating the file. one thing though all of them specify {start:0} and they seem to get all lines. im on the case =)
ok cool.
the issue was that from my package watchfd i couldn't know when the init state was ENOENT so the default behavior with undefined start was to emit only new lines (the tail).
this is fixed an published to npm as tailfd@0.1.4. A test has been updated to not pass start to ensure no regression.
Yeah, you are awesome (and fast)! Thanks so much!
Interesting, so it would have also worked with {start : 0}
?
I didn't even try that, -1
was kind of out of intuition :)
no problem. yeah start:0 would have worked. -1 gets clamped to 0 because that's just a wrong file offset =)
Hello
This is a really awesome module! Thanks! I have noticed that when tailing a file that does not yet exist and then appending lines to it, the first line does not emit a "line" event.
I did some animal testing below.
Thanks and best regards Max
How to reproduce
Watch a file that does not yet exist:
Then append some animals:
The
watcher
object does not emit a "line" event for "monkey" but it does for "bird" and "spider". Also tried elephants and lions. Same problem.Workaround #1
Touch the file before writing to it.
Same as above:
But
touch
the file before appending the first line:Emits "line" events for all the animals.
Workaround #2
Set negative
start
optionWith
start
option-1
:Append some animals without
touch
ing:Emits "line" events for all the animals. First line can have a delay.