From bf8b87411701667a8d9e608b2e7b3171c4c3e551 Mon Sep 17 00:00:00 2001 From: Valery Sizov Date: Thu, 6 Nov 2014 11:47:38 +0200 Subject: [PATCH] fix system silent call --- lib/gitlab/git_ref_validator.rb | 2 +- lib/gitlab/utils.rb | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/gitlab/git_ref_validator.rb b/lib/gitlab/git_ref_validator.rb index 0fdd4dbe577..39d17def930 100644 --- a/lib/gitlab/git_ref_validator.rb +++ b/lib/gitlab/git_ref_validator.rb @@ -6,7 +6,7 @@ module Gitlab # Returns true for a valid reference name, false otherwise def validate(ref_name) Gitlab::Utils.system_silent( - %W(git check-ref-format refs/#{ref_name})) == 0 + %W(git check-ref-format refs/#{ref_name})) end end end diff --git a/lib/gitlab/utils.rb b/lib/gitlab/utils.rb index bc30364550a..bd184c27187 100644 --- a/lib/gitlab/utils.rb +++ b/lib/gitlab/utils.rb @@ -5,10 +5,9 @@ module Gitlab # Run system command without outputting to stdout. # # @param cmd [Array] - # @return [Integer] exit status + # @return [Boolean] def system_silent(cmd) - IO.popen(cmd).close - $?.exitstatus + Popen::popen(cmd).last.zero? end end end