Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
boutil opened this issue Jun 11, 2012 · 3 comments
Closed

Comments

@boutil
Copy link

boutil commented Jun 11, 2012

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

@rdp
Copy link
Owner

rdp commented Jun 12, 2012

yep I'll get on it...

@rdp
Copy link
Owner

rdp commented Jun 27, 2012

Ok committed a patch for 2.5.0
-r

On Mon, Jun 11, 2012 at 4:04 PM, Cédric Boutillier
reply@reply.github.com
wrote:

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


Reply to this email directly or view it on GitHub:
#12

@rdp
Copy link
Owner

rdp commented Dec 28, 2012

closing if no comment

@rdp rdp closed this as completed Dec 28, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants