Skip to content

Commit d7f77f6

Browse files
author
Drew Blessing
committed
Fix custom hook output and return values
1 parent dbdcc5f commit d7f77f6

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/gitlab_custom_hook.rb

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ def post_receive(changes, repo_path)
2222
def update(ref_name, old_value, new_value, repo_path)
2323
hook = hook_file('update', repo_path)
2424
return true if hook.nil?
25-
system(hook, ref_name, old_value, new_value) ? true : false
25+
system(hook, ref_name, old_value, new_value)
26+
$?.exitstatus == 0 ? true : false
2627
end
2728

2829
private
@@ -51,11 +52,11 @@ def call_receive_hook(hook, changes)
5152
# need to close stdin before reading stdout
5253
stdin.close
5354

54-
# only output stdut_stderr if scripts doesn't return 0
5555
unless wait_thr.value == 0
5656
exit_status = false
57-
stdout_stderr.each_line { |line| puts line }
5857
end
58+
59+
stdout_stderr.each_line { |line| puts line }
5960
end
6061

6162
exit_status

0 commit comments

Comments
 (0)