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:
parent
5f37d0d1c8
commit
2145b650a6
|
@ -223,12 +223,9 @@ module Redmine
|
||||||
cmd = "#{cmd} 2>>#{shell_quote(Rails.root.join('log/scm.stderr.log').to_s)}"
|
cmd = "#{cmd} 2>>#{shell_quote(Rails.root.join('log/scm.stderr.log').to_s)}"
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
if RUBY_VERSION < '1.9'
|
|
||||||
mode = "r+"
|
mode = "r+"
|
||||||
else
|
|
||||||
mode = "r+:ASCII-8BIT"
|
|
||||||
end
|
|
||||||
IO.popen(cmd, mode) do |io|
|
IO.popen(cmd, mode) do |io|
|
||||||
|
io.set_encoding("ASCII-8BIT") if io.respond_to?(:set_encoding)
|
||||||
io.close_write
|
io.close_write
|
||||||
block.call(io) if block_given?
|
block.call(io) if block_given?
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue