From: James Coglan Date: 2009-09-21T02:50:30+09:00 Subject: Thread-safe FileUtils.cd --001517503d741d8317047406008c Content-Type: text/plain; charset=ISO-8859-1 Hi all, I have a build tool that I've written in Ruby that uses this construct to enter a directory, perform some long-running (several seconds) tasks then exit back to the original working directory: FileUtils.cd(dir) do # expensive operations end Now I'm trying to write another tool that uses this build library to run several builds at once in different Threads. Problem is, the FileUtils.cd commands overlap and conflict with each other, causing the builds to fail. I have a lot of code already out in production that relies on this directory being set correctly (users can write hooks into the build system, and these hooks assume a certain working directory), so I can't remove the cd() call. My question is, is there a way of setting the working directory on a per-thread basis, or is it a global property of the Ruby process that cannot be made thread-safe? Cheers, James -- James Coglan http://jcoglan.com --001517503d741d8317047406008c--