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
This commit is contained in:
Toshi MARUYAMA 2012-03-28 10:54:38 +00:00
parent 5f37d0d1c8
commit 2145b650a6

View 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