Skip to content

Instantly share code, notes, and snippets.

@gioele
Created October 6, 2009 15:48
Show Gist options
  • Save gioele/203140 to your computer and use it in GitHub Desktop.
Save gioele/203140 to your computer and use it in GitHub Desktop.
Title: Files are not flushed to disk unless explicitly 'close'd
Open files are not flushed to disk when an application exits. If the .close method is used, the files are correctly written to disk.
This little test-case illustrates the problem:
out = File.new('foobar', 'w')
out.write('hi')
out.puts
Once this script has been executed by JRuby the foobar file will be empty. When the script is executed with MRI (1.8.7) the file contains the expected "hi\n". If out.close is used both JRuby and MRI will produce a file with the correct content.
I do not know whether this is a bug in JRuby or in MRI.
I found this inconsistency both in JRuby 1.3.1 and 1.4-RC1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment