Capturing system console information

Ryan Mckenzie wrote:

Hello,

I have a simple web application that executes a .exe program through my
controller. The exe program processes some information and displays an
output on the script/server output. Is it possible to catch this
information from the console and output it back to the user?

I have tried the following but it does not seem to work:

puts << system.readlines(separator=$/)

Regards,
McKenzie.

Perhaps the backtick method would work better? I found that system() calls sometimes returned random data at the end of the result.

output = `/path/to/app/to/execute`
puts output

worked a lot better for my case.

HTH

Matt

Matt Harrison wrote:

Ryan Mckenzie wrote:

Regards,
McKenzie.

Perhaps the backtick method would work better? I found that system()
calls sometimes returned random data at the end of the result.

output = `/path/to/app/to/execute`
puts output

worked a lot better for my case.

HTH

Matt

Hi Matt,

I also need to input some parameters with the program to but I dont
think the backtick method supports that? This is what I have so far...

if system("\"E:\\rails\\public\\progs\\web.exe\"
\"E:\\rails\\public\\progs\\temp.txt\" set=\"10\"")
      flash[:notice]= "Console output here"
end

Thanks