From: stephen.hill@... (Steve Hill) Date: 2001-07-17T19:55:19+09:00 Subject: [ruby-talk:17984] waiting for `backquotes` to finish Hi, I'm sure this isn't really a ruby specific question, but since I scipt in ruby, maybe someone has a good answer... Some of the scripting relies on some of the standard unix tools to do its work, called using backquotes. e.g. the following facet which processes the columns of a file previously created with grep. `grep FOO foo.txt > foo.tmp` flag?=false hash=Hash.new IO.for_each("foo.tmp") do |line| unless flag? do cols=line.split (0...cols).each {|i| hash[i]=Bar.new} end cols=line.split hash.each {|k,v| v.process(cols[i]) } #A end The problem is that the script may fail at the line marked A because the file "foo.tmp" has either not been written at all, or has not been completely written. The first problem can be solved by inserting the following section after the grep. while !File.stat?("foo.tmp").size? sleep 0.001 end Does anyone know how to test that "foo.tmp" has been completely written? Best regards Steve