lucagrulla / node-tail

The zero dependency Node.js module for tailing a file
https://www.lucagrulla.com/node-tail/
MIT License
467 stars 75 forks source link

Allow setting `follow` to `false`. #130

Closed bruce-one closed 3 years ago

bruce-one commented 3 years ago

The || true meant this was always being set to true.

Just if of use :-) (No stress at all if you want to implement this in a different way, just figured might as well create a pr rather than just an issue :-) )

(Was just trying with new Tail("fileToTail", { follow: false }), for context)

bruce-one commented 3 years ago

While mucking around with this, I also found that the rename logic didn't work without swapping:

if (filename === undefined || filename !== this.filename) {

to

if (filename === undefined || filename === this.filename) {

this was on Linux, so not sure if this is acting differently to what you're seeing; but thought it might be worth mentioning too :-) (It would seem on Linux that the rename argument is the "from" filename, I guess?)

lucagrulla commented 3 years ago

Thanks @bruce-one .

I'll merge the PR and double-check the rename scenario.