-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Tuesday 10 July 2001 11:57am, Jim Freeze wrote:
>  cat gnu_input | gnuplot | xv - &
>
> Whe automating with Ruby, I don't want to write gnu_input into a
> file. So I tried
>
>  cmd = "gnuplot | xv - &"
>  IO.popen(cmd, "w") {|f| f.puts gnu_input}
>
>  And it fails, giving the reason as an empty temp file.
>  However, if I don't put the job in the background, then
>  it works. EG
>
>  cmd = "gnuplot | xv -"
>  IO.popen....
>
>  works.
>
> Is there a way to put xv in the background after the popen call
> or another way to do this so xv starts in the background?

Try something like this:

cmd = "gnuplot | xv -"
fork {
  IO.popen(cmd,"w") { |f| f.puts gnu_input }
}
# do whatever else, and when you want to wait for xv to go away:
Process.wait

- -- 
Wesley J. Landaker - wjl / mindless.com
http://www.landaker.net            PGP DSS/DH Key: 0x0F338E07
PGPKey FP: 3AAA 424B B488 198E B68B  C0E5 390A BACA 0F33 8E07
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6a (GNU/Linux)
Comment: All your base are belong to us.

iEYEARECAAYFAjtLk7YACgkQOQq6yg8zjgdi2QCeMHyKgccjxnmgvqlmNiOvtM4c
tZIAn1GIydiwtwRTDJdC5/Ln+XUftBmw
=BPc2
-----END PGP SIGNATURE-----