From 2145b650a66a5507d2582974a34b98bb84850b0c Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Wed, 28 Mar 2012 10:54:38 +0000 Subject: [PATCH] Ruby1.9: scm: use :set_encoding instead of "RUBY_VERSION < '1.9'" for IO.popen (#10470) git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9280 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/scm/adapters/abstract_adapter.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/redmine/scm/adapters/abstract_adapter.rb b/lib/redmine/scm/adapters/abstract_adapter.rb index bb46a4865..3797534c3 100644 --- a/lib/redmine/scm/adapters/abstract_adapter.rb +++ b/lib/redmine/scm/adapters/abstract_adapter.rb @@ -223,12 +223,9 @@ module Redmine cmd = "#{cmd} 2>>#{shell_quote(Rails.root.join('log/scm.stderr.log').to_s)}" end begin - if RUBY_VERSION < '1.9' - mode = "r+" - else - mode = "r+:ASCII-8BIT" - end + mode = "r+" IO.popen(cmd, mode) do |io| + io.set_encoding("ASCII-8BIT") if io.respond_to?(:set_encoding) io.close_write block.call(io) if block_given? end -- 2.39.5