Hi Sorry if this is the wrong list. Ive been reading up on ruby with the ruby cookbook and cant seem to find out how to call an externel process via rails web form. Im running ruby on rails on linux and need to call a externel process that will execute a command from my web app. Any pointers would be appreciated 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 -~----------~----~----~----~------~----~------~--~---
Peter De Berdt
2007-Sep-25 16:30 UTC
Re: How would i make a rails web form execute a system call
On 25 Sep 2007, at 18:18, Brent Brent wrote:> Sorry if this is the wrong list. Ive been reading up on ruby with the > ruby cookbook and cant seem to find out how to call an externel > process > via rails web form. Im running ruby on rails on linux and need to > call a > externel process that will execute a command from my web app. Any > pointers would be appreciated thanks.directory_listing = ´ls´ for example? (those are not the normal quote ('') symbol) Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
William Pratt
2007-Sep-25 16:37 UTC
Re: How would i make a rails web form execute a system call
If you want to run a command and gather it''s output from stdout, enclosing the command in backticks will do it, i.e. `ls`. If you want to run a command, but you don''t care about any output on stdout, instead you just want to know if the command was found and ran successfully, system is what you want, i.e. system("ls") . System returns true if the command is found and ran successfully, false otherwise. Brent Brent wrote:> Hi > > Sorry if this is the wrong list. Ive been reading up on ruby with the > ruby cookbook and cant seem to find out how to call an externel process > via rails web form. Im running ruby on rails on linux and need to call a > externel process that will execute a command from my web app. Any > pointers would be appreciated thanks. >-- Sincerely, William Pratt --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Brent Brent
2007-Sep-25 16:39 UTC
Re: How would i make a rails web form execute a system call
Thanks so much! -- 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 -~----------~----~----~----~------~----~------~--~---
Brent Brent
2007-Sep-25 16:41 UTC
Re: How would i make a rails web form execute a system call
Perfect thanks so much -- 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 -~----------~----~----~----~------~----~------~--~---
Dave Smith
2007-Sep-25 16:41 UTC
Re: How would i make a rails web form execute a system call
You probably already know this, but just in case... you can''t really run a command via a web form. You can invoke an action via a web form, and the action can run the command. You can run and capture the command like so... io = IO.popen("ls -lha") output = io.read io.close -- 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 -~----------~----~----~----~------~----~------~--~---