From f937e059493037f3e18896a81693de81cf6a69a1 Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 22 Jan 2015 15:51:20 +0100 Subject: Stop git zombie creation during force push check --- CHANGELOG | 2 +- lib/gitlab/force_push_check.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index e3fc463621c..25b539dac01 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,7 +20,7 @@ v 7.8.0 - - - - - + - Stop git zombie creation during force push check - - - diff --git a/lib/gitlab/force_push_check.rb b/lib/gitlab/force_push_check.rb index 6a52cdba608..6ba2c3ad00a 100644 --- a/lib/gitlab/force_push_check.rb +++ b/lib/gitlab/force_push_check.rb @@ -4,7 +4,7 @@ module Gitlab return false if project.empty_repo? if oldrev != Gitlab::Git::BLANK_SHA && newrev != Gitlab::Git::BLANK_SHA - missed_refs = IO.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev})).read + missed_refs, _ = Gitlab::Popen.popen(%W(git --git-dir=#{project.repository.path_to_repo} rev-list #{oldrev} ^#{newrev})) missed_refs.split("\n").size > 0 else false -- cgit v1.2.1 From a63187f28b18e2feea16681b313166a982254e4e Mon Sep 17 00:00:00 2001 From: Jacob Vosmaer Date: Thu, 22 Jan 2015 15:53:16 +0100 Subject: Don't create zombies with IO.popen The previous recommend incantation would leave the process we read from hanging around, even though it had finished. That gives you a 'defunct'/'zombie' process. --- doc/development/shell_commands.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/development/shell_commands.md b/doc/development/shell_commands.md index 1e51ad73e32..42f17e19536 100644 --- a/doc/development/shell_commands.md +++ b/doc/development/shell_commands.md @@ -108,7 +108,7 @@ In other repositories, such as gitlab-shell you can also use `IO.popen`. ```ruby # Safe IO.popen example -logs = IO.popen(%W(git log), chdir: repo_dir).read +logs = IO.popen(%W(git log), chdir: repo_dir) { |p| p.read } ``` Note that unlike `Gitlab::Popen.popen`, `IO.popen` does not capture standard error. -- cgit v1.2.1