IO.fsync not flushing buffer before sync
----------------------------------------

                 Key: JRUBY-3857
                 URL: http://jira.codehaus.org/browse/JRUBY-3857
             Project: JRuby
          Issue Type: Bug
          Components: Core Classes/Modules
    Affects Versions: JRuby 1.3.1, JRuby 1.3, JRuby 1.4
         Environment: any
            Reporter: Rick Ohnemus
            Priority: Minor


According to the docs for IO.fsync, it should flush the buffer (from MRI docs: 
Immediately writes all buffered data in ios to disk. ...).

I'm using the following patch (it seems to work, but I'm just getting back into 
Java after many years and it could very well be wrong):
{code}
--- a/src/org/jruby/RubyIO.java
+++ b/src/org/jruby/RubyIO.java
@@ -1688,7 +1688,10 @@ public class RubyIO extends RubyObject {

             myOpenFile.checkWritable(runtime);

-            myOpenFile.getWriteStream().sync();
+            Stream writeStream = myOpenFile.getWriteStream();
+
+            writeStream.fflush();
+            writeStream.sync();
         } catch (InvalidValueException ex) {
             throw runtime.newErrnoEINVALError();
         } catch (PipeException ex) {
{code}

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply via email to