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. -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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 > > MattHi 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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---