ruby-rdf/rdf-spec — pull request #3 by dwbutler (2012-09-10 22:21:24+00:00)
Title: Safer temp directory deletion

Recently I've been running the RDF specs (in raptor) and noticed the same problem in ruby 1.8.7 and 1.9.3. Sometimes, after running the specs, my entire working directory would get deleted! Luckily I had time machine turned on so I only lost about 45 minutes of work.

It turns out that @dir sometimes gets set to the current working directory. I have no idea why, but I suspect this is a behavior of Dir.tmpdir. Possibly something is setting the system's tmp dir as the current working dir.

Dir.mktmpdir seems to be safer because it at least creates a subdirectory in the system's temporary directory.