I want to run a task in Ruby for up to 10 seconds and kill this task if it took longer. This is done to prevent the external process from freezing. What is the best way to implement this? In particular, how to write the for_up_to_10_seconds function below?
loop do for_up_to_10_seconds do
source share