Hi everyone. I have a problem with this command: @arp_table = `arp -n` When I execute it on console, all is perfect, but when I put it in the script on Rails the string arp_table is empty and I don''t view any result. If I do a script like that: @list = `ls -l` all works perfectly. Where is the mistake ? Thanks in advance -- 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 -~----------~----~----~----~------~----~------~--~---
Misha Mistral wrote:> Hi everyone. > > I have a problem with this command: > > @arp_table = `arp -n` > > When I execute it on console, all is perfect,Are you passing arp any other arguments? On OS X, arp -n just prints a help message to stderr.> but when I put it in the > script on Rails the string arp_table is empty and I don''t view any > result. > > If I do a script like that: > > @list = `ls -l` > > all works perfectly. > > Where is the mistake ? >If arp -n may be printing to stderr, rather than stdout. Try: @arp_table = `arp -n 2>&1` --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Jeff Schwab wrote:> Misha Mistral wrote: >> Hi everyone. >> >> I have a problem with this command: >> >> @arp_table = `arp -n` >> >> When I execute it on console, all is perfect, > Are you passing arp any other arguments? On OS X, arp -n just prints a > help message to stderr. > >> Where is the mistake ? >> > > If arp -n may be printing to stderr, rather than stdout. Try: > > @arp_table = `arp -n 2>&1`Thank you for your reply. The problem was very silly. The user that execute the rails script is www-data, and the arp command isn''t in the user''s PATH variable. There was, also, a permission problem. I''ve installed sudo and I''ve solved. -- 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 -~----------~----~----~----~------~----~------~--~---
Quoting Misha Mistral <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>:> > Hi everyone. > > I have a problem with this command: > > @arp_table = `arp -n` > > When I execute it on console, all is perfect, but when I put it in the > script on Rails the string arp_table is empty and I don''t view any > result. >What user is the command running as? On my system (OpenSuSE 10.3) arp is in /sbin, i.e., root only. Jeffrey --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---