[Rails] Re: external programs

2009-04-15 Thread BenH

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  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 
> 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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: external programs

2009-04-15 Thread BenH

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 
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@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---