lib/shellshot.rb in shellshot-0.4.1 vs lib/shellshot.rb in shellshot-0.4.2
- old
+ new
@@ -15,22 +15,23 @@
attr_accessor :pid, :status, :options
def exec(command, options = {})
self.options = options
+ timeout = options[:timeout] || DEFAULT_TIMEOUT
prepare_pipes
self.pid = fork do
close_reading_pipes
redefine_stds
system_exec(command)
end
begin
- wait_for(options[:timeout] || DEFAULT_TIMEOUT)
+ wait_for(timeout)
rescue Timeout::Error => e
terminate_child_process
- raise
+ raise Timeout::Error, "execution of #{command} exceeded #{timeout} seconds"
end
true
end