]> source.dussan.org Git - redmine.git/commitdiff
Ruby1.9: scm: use :set_encoding instead of "RUBY_VERSION < '1.9'" for IO.popen (...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 28 Mar 2012 10:54:38 +0000 (10:54 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Wed, 28 Mar 2012 10:54:38 +0000 (10:54 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9280 e93f8b46-1217-0410-a6f0-8f06a7374b81

lib/redmine/scm/adapters/abstract_adapter.rb

index bb46a4865b66db1216433c04a7843135235469b4..3797534c373d7985d6fde059db5f231ecd29cb68 100644 (file)
@@ -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