lib/remote_run/runner.rb in remote_run-0.1.3 vs lib/remote_run/runner.rb in remote_run-0.1.4

- old
+ new

@@ -10,10 +10,13 @@ @hosts = [] @task_manager = @configuration.task_manager @host_manager = @configuration.host_manager @starting_number_of_tasks = @task_manager.count + @before_task = @configuration.before_task + @after_task = @configuration.after_task + @around_task = @configuration.around_task end def run setup_unlock_on_exit sync_working_copy_to_temp_location @@ -82,18 +85,20 @@ @children << task end def start_forked_task(host, task) begin + @before_task.call(host, task, self) this_host = host.dup unless this_host.copy_codebase @task_manager.add(task) status = 0 end - status = this_host.run(task.command) + @around_task.call { status = this_host.run(task.command) } host.unlock rescue Errno::EPIPE ensure + @after_task.call(host, task, self) Process.exit!(status) end end def find_lock_and_start