Skip to content

Commit ffdc8f9

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

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/gitlab_custom_hook.rb

Lines changed: 3 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,13 +52,12 @@ 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
5958
end
6059

60+
stdout_stderr.each_line { |line| puts line }
6161
exit_status
6262
end
6363

0 commit comments

Comments
 (0)