how i can follow to execute external programs: define, that they don''t hung with Kernel method system or another? may be use timeout? excuse me for my bad english :) -- 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 -~----------~----~----~----~------~----~------~--~---
you may try something along this line: timeout(10) do %x{sleep 12} end rescue Timeout::Error # Do something to handle the time out. puts "The sleep command timed out" end Hope that gets you going in a good direction. BenH On Apr 15, 7:41 am, Svetlana Vt <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> how i can follow to execute external programs: define, that they don''t > hung with Kernel method system or another? may be use timeout? > > excuse me for my bad english :) > -- > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Excuse the self reply - something that comes in handy is to capture the exit status of the external application. To do this use $?.exitstatus %x{echo "Hello World"} puts $?.exitstatus On Apr 15, 8:15 am, BenH <benh...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> you may try something along this line: > > timeout(10) do > %x{sleep 12} > end > > rescue Timeout::Error > # Do something to handle the time out. > puts "The sleep command timed out" > end > > Hope that gets you going in a good direction. > BenH > > On Apr 15, 7:41 am, Svetlana Vt <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > wrote: > > > how i can follow to execute external programs: define, that they don''t > > hung with Kernel method system or another? may be use timeout? > > > excuse me for my bad english :) > > -- > > Posted viahttp://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@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---