summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/gitlab_projects.rb7
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index d761026..d0b1e1f 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -99,11 +99,14 @@ class GitlabProjects
$logger.info "Importing project #{@project_name} from <#{@source}> to <#{full_path}>."
cmd = %W(git clone --bare -- #{@source} #{full_path})
+ pid = Process.spawn(*cmd)
+
begin
Timeout.timeout(timeout) do
- system(*cmd)
+ Process.wait(pid)
end
- rescue
+ rescue Timeout::Error
+ Process.kill('TERM', pid)
$logger.error "Importing project #{@project_name} from <#{@source}> failed due to timeout."
FileUtils.rm_rf(full_path)
false