File.new
Spent about three hours tracking down weirdness with the Ruby File class on Windows. My unit tests create several files, as does some of the code I'm working on. All the tests work fine on my Mac, and the tests all clean up after themselves just fine. Deploy it all to Windows, and all of a sudden tests are failing and there are a ton of test files/folders leftover. Couldn't leave well enough alone.Turns out that File.new on Windows leaves a handle open. Maybe it does on the Mac, too. Didn't dig in. All I know is that on Windows I had to explicitly call close() on each file to ensure that there weren't any handles laying around, but the Mac worked fine without it. This is, incidentally, different from Java. In Java a File object instance is so abstract that the file just has to exist.
No comments:
Post a Comment