Commit 2e484585 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Use Process spawn

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 318eb652
...@@ -99,11 +99,14 @@ class GitlabProjects ...@@ -99,11 +99,14 @@ class GitlabProjects
$logger.info "Importing project #{@project_name} from <#{@source}> to <#{full_path}>." $logger.info "Importing project #{@project_name} from <#{@source}> to <#{full_path}>."
cmd = %W(git clone --bare -- #{@source} #{full_path}) cmd = %W(git clone --bare -- #{@source} #{full_path})
pid = Process.spawn(*cmd)
begin begin
Timeout.timeout(timeout) do Timeout.timeout(timeout) do
system(*cmd) Process.wait(pid)
end end
rescue rescue Timeout::Error
Process.kill('TERM', pid)
$logger.error "Importing project #{@project_name} from <#{@source}> failed due to timeout." $logger.error "Importing project #{@project_name} from <#{@source}> failed due to timeout."
FileUtils.rm_rf(full_path) FileUtils.rm_rf(full_path)
false false
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment