when doing a :
r = IO.popen( cmd )
are the outputs of the cmd still separated in $stdout and stderr ?
how to retrieve them.
my basic usage is for an xslt transform (xslt 2.0) using saxon8.jar :
cmd = java -cp …/saxon-resources8-9/saxon8.jar net.sf.saxon.Transform
“#{the_xml_file}” “#{the_xsl_file}”"
Une Bévue wrote:
cmd = java -cp …/saxon-resources8-9/saxon8.jar net.sf.saxon.Transform
"#{the_xml_file}" "#{the_xsl_file}""
From the documentation[1]:
" Runs the specified command string as a subprocess; the subprocess’s
standard input and output will be connected to the returned IO object."
This means you can reading from the returned IO object will get you the
standard output and writing to it will send the data to the standard
input of the application. This works just like any other IO of File
object.
If you need to get standard error as well, you need to use
Open3#popen3[2]
Hope that helps.
-Justin
[1]class IO - RDoc Documentation
[2]http://ruby-doc.org/core/classes/Open3.html