From: Robert Klemme Date: 2009-09-22T17:41:18+09:00 Subject: Re: Thread-safe FileUtils.cd 2009/9/20 Markus Schirp : > Forcing the users to use absolute paths may just hides the problem. Maybe > you should expand the users "relative" paths before using them. > > Or monkeypatch FileUtils, and maybe dozens ruby core classes to support a > "thread-safe" cwd. That would be an option but IMHO it would be tedious and error prone. You can easily miss a class and introduce unwanted effects. As far as I can see the only way to make cwd thread safe would be to use the block form and synchronize access, i.e. one thread changes cwd, does its work and returns cwd to the old status. For obvious reasons this is not really a good idea. IMHO the only reasonable way to go is to a) use cwd only in single threaded programs or with explicit synchronization guards b) do not change cwd and use absolute path names, even if that means converting user input / method arguments Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/