Hi, 

From: Ralf <lausianne / gmx.net>
Subject: Re: tkgnuplot problem: fork() on win (popen3 for windows?)
Date: Mon, 3 Feb 2003 18:33:26 +0900
Message-ID: <3e3e32ea$1 / epflnews.epfl.ch>
> Here you go:

Thank you for your report. 
Well, could you try the following test?

1. replace line 71--80
  ---<before>------------------------------
    begin
      ret = ''
      @to_cmd.write "print '<OK>'\n"
      while s = @from_cmd.gets
	break if s == "<OK>\n"
	ret << s
      end
    rescue Errno::EPIPE
      raise $!,'Lost gnuplot process (gnuplot argument error?)'
    end
  -----------------------------------------
        |
        v
  ---<after>-------------------------------
    begin
      ret = ''
      STDERR.print "before first write to the pipe\n"
      @to_cmd.write "print '<OK>'\n"
      STDERR.print "after first write to the pipe\n"
      while s = @from_cmd.gets
	break if s == "<OK>\n"
	ret << s
      end
      STDERR.print "succeed first read of the pipe\n"
    rescue Errno::EPIPE
      raise $!,'Lost gnuplot process (gnuplot argument error?)'
    end
  -----------------------------------------

2. replace line 105
  ---<before>------------------------------
	@to_cmd.write cmd.chomp + "\n"
  -----------------------------------------
        |
        v
  ---<after>-------------------------------
        STDERR.print("before cmd write:",cmd.chomp.inspect,"\n")
	@to_cmd.write(cmd.chomp + "\n")
        STDERR.print("after cmd write\n")
  -----------------------------------------

3. try the test script
  -----------------------------------------
  require 'gnuplot.rb' # maybe need change the path of library
  STDERR.sync = true
  gp = GnuplotProcess.new('c:\program files\design\gnuplot\gp371w32\pgnuplot.exe')
  sleep 1
  gp.cmd('plot sin(x)')
  sleep 5
  -----------------------------------------

4. please report the result of the test script

-- 
                                  Hidetoshi NAGAI (nagai / ai.kyutech.ac.jp)