From: unbewusst.sein@... (=?ISO-8859-1?Q?Une_B=E9vue?=) Date: 2010-03-10T19:45:07+09:00 Subject: how to test if a file is open ? 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 -- � L'essence m�me du g�nie, c'est de mettre en pratique les id�es les plus simples. � (Charles Peguy)