diff options
author | Kamil TrzciĆski <ayufan@ayufan.eu> | 2017-04-18 13:44:12 +0300 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2017-04-18 13:45:10 +0300 |
commit | 68bf7edfb42babe042c12d9324894759062c586b (patch) | |
tree | fa6a53113f3c0e8574d2a70e245fb76d7aee83be /lib/gitlab/ci/trace/stream.rb | |
parent | 00b993ae48d475867b3c59d3cb1f5fc85fea6c1e (diff) |
Merge branch 'enforce-Ansi2html-output-encoding' into 'master'
Just enforce the output encoding for Ansi2html
See merge request !10758
Diffstat (limited to 'lib/gitlab/ci/trace/stream.rb')
-rw-r--r-- | lib/gitlab/ci/trace/stream.rb | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb index b929bdd55bc..68b14c7c04c 100644 --- a/lib/gitlab/ci/trace/stream.rb +++ b/lib/gitlab/ci/trace/stream.rb @@ -14,14 +14,7 @@ module Gitlab def initialize @stream = yield - if @stream - @stream.binmode - # Ci::Ansi2html::Converter would read from @stream directly, - # using @stream.each_line to be specific. It's safe to set - # the encoding here because IO#seek(bytes) and IO#read(bytes) - # are not characters based, so encoding doesn't matter to them. - @stream.set_encoding(Encoding.default_external) - end + @stream&.binmode end def valid? @@ -68,8 +61,8 @@ module Gitlab def html(last_lines: nil) text = raw(last_lines: last_lines) - stream = StringIO.new(text) - ::Ci::Ansi2html.convert(stream).html + buffer = StringIO.new(text) + ::Ci::Ansi2html.convert(buffer).html end def extract_coverage(regex) |