diff --git a/CHANGELOG b/CHANGELOG index 63b04cc5b36649d93a7e0f4d743cfeafe3e7e16a..bf7a1a055bb87c88a3d43af616755afb46a772b7 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,6 @@ +V3.0.1 + - Prevent custom_hooks pre-receive from freezing + v3.0.0 - Remove rm-tag command (Robert Schilling) - Remove create-branch and rm-branch commands (Robert Schilling) diff --git a/lib/gitlab_custom_hook.rb b/lib/gitlab_custom_hook.rb index ac6837de26845a3ec1f7ecd7965fa92e8c1b7d3c..ffd369e79b8a9950b0020abc8013f2c3e17829ba 100644 --- a/lib/gitlab_custom_hook.rb +++ b/lib/gitlab_custom_hook.rb @@ -33,6 +33,7 @@ class GitlabCustomHook Open3.popen2e(hook) do |stdin, stdout_stderr, wait_thr| exit_status = true stdin.sync = true + $stdout.sync = true # in git, pre- and post- receive hooks may just exit without # reading stdin. We catch the exception to avoid a broken pipe @@ -48,11 +49,12 @@ class GitlabCustomHook # need to close stdin before reading stdout stdin.close + stdout_stderr.each_line { |line| puts line } + unless wait_thr.value == 0 exit_status = false end - stdout_stderr.each_line { |line| puts line } end exit_status