INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Upgrade to 8.6 causes file problems.

Upgrade to 8.6 causes file problems.

(OP)
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

RE: Upgrade to 8.6 causes file problems.

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.

RE: Upgrade to 8.6 causes file problems.

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close