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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
ee3b0c3a
Commit
ee3b0c3a
authored
Apr 17, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make sure we're giving Encoding.default_external
parent
eeaeb275
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
5 deletions
+11
-5
lib/gitlab/ci/trace/stream.rb
lib/gitlab/ci/trace/stream.rb
+2
-2
spec/lib/gitlab/ci/trace/stream_spec.rb
spec/lib/gitlab/ci/trace/stream_spec.rb
+9
-3
No files found.
lib/gitlab/ci/trace/stream.rb
View file @
ee3b0c3a
...
@@ -14,6 +14,7 @@ module Gitlab
...
@@ -14,6 +14,7 @@ module Gitlab
def
initialize
def
initialize
@stream
=
yield
@stream
=
yield
@stream
.
binmode
end
end
def
valid?
def
valid?
...
@@ -51,7 +52,7 @@ module Gitlab
...
@@ -51,7 +52,7 @@ module Gitlab
read_last_lines
(
last_lines
)
read_last_lines
(
last_lines
)
else
else
stream
.
read
stream
.
read
end
end
.
force_encoding
(
Encoding
.
default_external
)
end
end
def
html_with_state
(
state
=
nil
)
def
html_with_state
(
state
=
nil
)
...
@@ -113,7 +114,6 @@ module Gitlab
...
@@ -113,7 +114,6 @@ module Gitlab
end
end
chunks
.
join
.
lines
.
last
(
last_lines
).
join
chunks
.
join
.
lines
.
last
(
last_lines
).
join
.
force_encoding
(
Encoding
.
default_external
)
end
end
end
end
end
end
...
...
spec/lib/gitlab/ci/trace/stream_spec.rb
View file @
ee3b0c3a
...
@@ -2,7 +2,7 @@ require 'spec_helper'
...
@@ -2,7 +2,7 @@ require 'spec_helper'
describe
Gitlab
::
Ci
::
Trace
::
Stream
do
describe
Gitlab
::
Ci
::
Trace
::
Stream
do
describe
'delegates'
do
describe
'delegates'
do
subject
{
described_class
.
new
{
nil
}
}
subject
{
described_class
.
new
{
StringIO
.
new
}
}
it
{
is_expected
.
to
delegate_method
(
:close
).
to
(
:stream
)
}
it
{
is_expected
.
to
delegate_method
(
:close
).
to
(
:stream
)
}
it
{
is_expected
.
to
delegate_method
(
:tell
).
to
(
:stream
)
}
it
{
is_expected
.
to
delegate_method
(
:tell
).
to
(
:stream
)
}
...
@@ -43,13 +43,19 @@ describe Gitlab::Ci::Trace::Stream do
...
@@ -43,13 +43,19 @@ describe Gitlab::Ci::Trace::Stream do
it
'forwards to the next linefeed, case 1'
do
it
'forwards to the next linefeed, case 1'
do
stream
.
limit
(
7
)
stream
.
limit
(
7
)
expect
(
stream
.
raw
).
to
eq
(
''
)
result
=
stream
.
raw
expect
(
result
).
to
eq
(
''
)
expect
(
result
.
encoding
).
to
eq
(
Encoding
.
default_external
)
end
end
it
'forwards to the next linefeed, case 2'
do
it
'forwards to the next linefeed, case 2'
do
stream
.
limit
(
29
)
stream
.
limit
(
29
)
expect
(
stream
.
raw
).
to
eq
(
"
\e
[01;32m許功蓋
\e
[0m
\n
"
)
result
=
stream
.
raw
expect
(
result
).
to
eq
(
"
\e
[01;32m許功蓋
\e
[0m
\n
"
)
expect
(
result
.
encoding
).
to
eq
(
Encoding
.
default_external
)
end
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