Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Upgrade to 8.6 causes file problems.

Status
Not open for further replies.

fdservices

IS-IT--Management
Mar 10, 2005
52
FR
I have an simple script which opens a file, reads it and puts each line, until it reaches an eof and then closes.

This is then called by other scripts which are performing actions and logging the results. So the first script reads the log, as it is written, and displays the progress.

Up until now this has worked fine, but with 8.6 it has stopped working and just hangs after a few lines of output. I have read about blocking but the examples shown in the manual make no difference to the results e.g.
Code:
proc GetData {chan} {
    if {[gets $chan line] >= 0} {
        puts $line
    }
    if {[eof $chan]} {
        close $chan
    }
}

fconfigure $chan -blocking 0 -buffering line -translation crlf
fileevent $chan readable [list GetData $chan]

What am I missing?

Andrew
 
Any insight as to which line it is hanging at? Unfortunately I'm thinking something as painful as
Code:
proc GetData {chan} {
    puts "1"
    if {[gets $chan line] >= 0} {
        puts $line
    }
    puts "2"
    if {[eof $chan]} {
        puts "2.1"
        close $chan
        puts "2.2"
    }
    puts "3"
}
and watch to see where it locks up. This might offer some insight to see if something is triggering $chan to close unexpectedly.
 
OK, I ran some more tests as suggested and it appears that the [eof $chan] returns true even though the file is still open and being appended to.

So I need to work out how to wait until the next line is written and then to read that line, until the real eof occurs

Andrew
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top