I am trying to tail a file using fileevent
(Should only Tcl 8.4 version, so I can't use chan
command).
% proc GetData {chan} {
set data [read $chan]
puts "[string length $data] $data"
if {[eof $chan]} {
fileevent $chan readable {}
}
}
%
%
%
% set fp [open "|tail -f /home/dinesh/input" r+]
file7
% fconfigure $fp
-blocking 1 -buffering full -buffersize 4096 -encoding utf-8 -eofchar {{} {}} -translation {auto lf}
% fconfigure $fp -blocking 0 -buffering line
%
%
%
%
% fileevent $fp readable [list GetData $fp]
%
I have changed the file contents using cat
command in another terminal, but still GetData
is not getting called.
With gets $fp line
, I am able to get the modified contents, but why fileevent is not triggered ?