Skip to content

change the pipe calling the gnuplot command from a write-only to read-write? #12

@boutil

Description

@boutil

Hi!

In Debian, there is this bug report by a user:
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=626984
reported also on rubyforge:
http://rubyforge.org/tracker/index.php?func=detail&aid=29177&group_id=173&atid=741
proposing to transform the pipe calling the gnuplot command from write-only to read-write, so that the output of the plot could be stored in a variable.

Here is the relevant part of the patch

--- gnuplot.rb.orig 2005-11-15 03:33:42.000000000 +0100
+++ gnuplot.rb  2011-05-06 23:04:02.000000000 +0200
@@ -56,7 +56,12 @@

   def Gnuplot.open( persist=true )
     cmd = Gnuplot.gnuplot( persist ) or raise 'gnuplot not found'
-    IO::popen( cmd, "w") { |io| yield io }
+    IO::popen( cmd, "w+") { |io|
+      yield io
+      io.close_write
+      @output = io.read
+     }
+    return @output
   end 

the rest is about adding a smooth attribute, but this has already been included.
Would you consider this modification as possible?

Thanks!

Cédric

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions