diff options
author | Valery Sizov <valery@gitlab.com> | 2016-07-04 20:04:29 +0300 |
---|---|---|
committer | Valery Sizov <valery@gitlab.com> | 2016-07-04 20:16:55 +0300 |
commit | 926a8ab4765fe9249bfb54926ef8efa3ee78fd16 (patch) | |
tree | 50264f13568e31452ed3705f5cf0f1f509f3b032 /lib | |
parent | f60b48bdcb4762451618fe03bca98581282a0904 (diff) |
Handle custom Git hook result in GitLab UI
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/hook.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gitlab/git/hook.rb b/lib/gitlab/git/hook.rb index 5415f4844d3..420c6883c45 100644 --- a/lib/gitlab/git/hook.rb +++ b/lib/gitlab/git/hook.rb @@ -41,7 +41,7 @@ module Gitlab chdir: repo_path } - Open3.popen3(vars, path, options) do |stdin, _, stderr, wait_thr| + Open3.popen3(vars, path, options) do |stdin, stdout, stderr, wait_thr| exit_status = true stdin.sync = true @@ -60,7 +60,7 @@ module Gitlab unless wait_thr.value == 0 exit_status = false - exit_message = stderr.gets + exit_message = retrieve_error_message(stderr, stdout) end end @@ -76,6 +76,11 @@ module Gitlab [status, nil] end + + def retrieve_error_message(stderr, stdout) + err_message = stderr.gets + err_message.blank? ? stdout.gets : err_message + end end end end |