Open idanya opened 6 years ago
+1
The tail only detect changes after reaching to the EOF. If you do not consume the tail.Lines chan, the sendLine func will be blocked. The tail may not be able to reach to the EOF, thus cannot detect the file deletion change.
I can see that sendLine is blocking with the chan, but assuming I will eventually process all chan lines (and I do), the tail loop will try to read the next line and will fail, causing the loop to end with tail.Killf()
. This should close the file descriptor/reader, isn't it?
I am tailing a file that at some point (while tailing) gets deleted. I don't use reopen option, when the file is deleted I expect the tail to stop. The tail really stops, but I can see the file descriptor is not. when running
lsof
I can see all files tailed with a "(deleted)" string at the end.Seems weird as
tailFileSync
starts withdefer tail.close()
and when the file gets deleted anErrStop
is raised and should just cause a return (triggering the defer). What am I missing?