From 236de8be1a2934f948b663bca65ba9eb8c9b4761 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Wed, 31 Aug 2011 12:17:52 -0400 Subject: [PATCH] support providing a timeout to rsync for slower connections --- lib/hydra/sync.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/hydra/sync.rb b/lib/hydra/sync.rb index c7bace4..4201094 100644 --- a/lib/hydra/sync.rb +++ b/lib/hydra/sync.rb @@ -28,6 +28,7 @@ module Hydra #:nodoc: @connect = worker_opts.fetch('connect') { raise "You must specify an SSH connection target" } @ssh_opts = worker_opts.fetch('ssh_opts') { "" } @remote_dir = worker_opts.fetch('directory') { raise "You must specify a remote directory" } + @timeout = worker_opts.fetch('timeout') { 2 } @result = 0 return unless sync_opts @@ -50,7 +51,7 @@ module Hydra #:nodoc: 'rsync', '-avz', '--delete', - '--timeout=2', + "--timeout=#{@timeout}", exclude_opts, File.expand_path(@local_dir)+'/', "-e \"ssh #{@ssh_opts}\"", @@ -58,6 +59,7 @@ module Hydra #:nodoc: ].join(" ") trace rsync_command trace `#{rsync_command}` + @result = $?.exitstatus end