U
Une Bévue
i'd like to know how to test if a file is open from another app ?
i've read http://www.ruby-forum.com/topic/144114
and have tested with :
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
and
MacRuby version 0.5 (ruby 1.9.0) [universal-darwin10.0, x86_64]
the following :
f = File.new("/Users/yt/dev/Signature/signatures.txt")
puts "f.flock(File::LOCK_EX) : #{f.flock(File::LOCK_EX)}"
puts "f.flock(File::LOCK_UN) : #{f.flock(File::LOCK_UN)}"
puts "f.flock(File::LOCK_EX | File::LOCK_NB) : #{f.flock(File::LOCK_EX |
File::LOCK_NB)}"
giving the same result in both cases :
f.flock(File::LOCK_EX) : 0
f.flock(File::LOCK_UN) : 0
f.flock(File::LOCK_EX | File::LOCK_NB) : 0
i've read http://www.ruby-forum.com/topic/144114
and have tested with :
ruby 1.8.7 (2008-08-11 patchlevel 72) [universal-darwin10.0]
and
MacRuby version 0.5 (ruby 1.9.0) [universal-darwin10.0, x86_64]
the following :
f = File.new("/Users/yt/dev/Signature/signatures.txt")
puts "f.flock(File::LOCK_EX) : #{f.flock(File::LOCK_EX)}"
puts "f.flock(File::LOCK_UN) : #{f.flock(File::LOCK_UN)}"
puts "f.flock(File::LOCK_EX | File::LOCK_NB) : #{f.flock(File::LOCK_EX |
File::LOCK_NB)}"
giving the same result in both cases :
f.flock(File::LOCK_EX) : 0
f.flock(File::LOCK_UN) : 0
f.flock(File::LOCK_EX | File::LOCK_NB) : 0