'system' and windows and an external program

Dear all,

I have a Ruby program that does some lengthy calculations and outputs
a matrix, which I’d like to write to a Postscript or PDF using Latex
for readability
(and re-usability in some lengthier text).
I have managed to put together the Latex code using Ruby, so I can
Latex using the system command

system(‘latex ’ + filename[0…filename.index(’.’)] + ‘.tex’)

This works.
To turn it into a Postscript file, I need another command

   system('dvips ' +  filename[0...filename.index('.')])

This works also and creates a new Postscript file.
But now, I’d like to open a Ghostview window to show the output in the
Postscript file automatically from the same Ruby script that did all
previous work and I’d like Ghostscript to stay open even after the Ruby
program finishes.

I’ve tried
system(‘gsview32 ’ + filename[0…filename.index(’.’)] +

but here nothing happens - no Ghostscript window pops up and nothing
else happens. So I still need to call Ghostscript by hand.
How could this problem be solved in Windows XP?
Is the solution any different under Linux ?

Thank you very much!

Best regards,


On Wed, 2 Aug 2006 [email protected] wrote:

I’ve tried
system(‘gsview32 ’ + filename[0…filename.index(’.’)] + ‘.ps’),

perhaps? eg does your pathname have two extensions?


This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs