Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
c26b1265
Commit
c26b1265
authored
Apr 17, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure @stream.each_line would tag Encoding.default_external
parent
ee3b0c3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
4 deletions
+16
-4
lib/gitlab/ci/trace/stream.rb
lib/gitlab/ci/trace/stream.rb
+2
-0
spec/lib/gitlab/ci/trace/stream_spec.rb
spec/lib/gitlab/ci/trace/stream_spec.rb
+14
-4
No files found.
lib/gitlab/ci/trace/stream.rb
View file @
c26b1265
...
@@ -15,6 +15,8 @@ module Gitlab
...
@@ -15,6 +15,8 @@ module Gitlab
def
initialize
def
initialize
@stream
=
yield
@stream
=
yield
@stream
.
binmode
@stream
.
binmode
# Ci::Ansi2html::Converter would read from @stream directly
@stream
.
set_encoding
(
Encoding
.
default_external
)
end
end
def
valid?
def
valid?
...
...
spec/lib/gitlab/ci/trace/stream_spec.rb
View file @
c26b1265
...
@@ -34,12 +34,12 @@ describe Gitlab::Ci::Trace::Stream do
...
@@ -34,12 +34,12 @@ describe Gitlab::Ci::Trace::Stream do
end
end
context
'when the trace contains ANSI sequence and Unicode'
do
context
'when the trace contains ANSI sequence and Unicode'
do
let
(
:stream
)
do
let
(
:io
)
do
described_class
.
new
do
File
.
open
(
expand_fixture_path
(
'trace/ansi-sequence-and-unicode'
))
File
.
open
(
expand_fixture_path
(
'trace/ansi-sequence-and-unicode'
))
end
end
end
let
(
:stream
)
{
described_class
.
new
{
io
}
}
it
'forwards to the next linefeed, case 1'
do
it
'forwards to the next linefeed, case 1'
do
stream
.
limit
(
7
)
stream
.
limit
(
7
)
...
@@ -57,6 +57,16 @@ describe Gitlab::Ci::Trace::Stream do
...
@@ -57,6 +57,16 @@ describe Gitlab::Ci::Trace::Stream do
expect
(
result
).
to
eq
(
"
\e
[01;32m許功蓋
\e
[0m
\n
"
)
expect
(
result
).
to
eq
(
"
\e
[01;32m許功蓋
\e
[0m
\n
"
)
expect
(
result
.
encoding
).
to
eq
(
Encoding
.
default_external
)
expect
(
result
.
encoding
).
to
eq
(
Encoding
.
default_external
)
end
end
# See https://gitlab.com/gitlab-org/gitlab-ce/issues/30796
it
'reads in binary, output as Encoding.default_external'
do
stream
.
limit
(
29
)
result
=
io
.
read
# Ci::Ansi2html::Converter would read with each_line
expect
(
result
).
to
eq
(
"
\e
[01;32m許功蓋
\e
[0m
\n
"
)
expect
(
result
.
encoding
).
to
eq
(
Encoding
.
default_external
)
end
end
end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment