BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
faa5dffb
Commit
faa5dffb
authored
Apr 13, 2017
by
Lin Jen-Shin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
After Trace#limit, we seek to the next line in case
of breaking ANSI sequence or Unicode
parent
7629c9ec
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
3 deletions
+32
-3
stream.rb
lib/gitlab/ci/trace/stream.rb
+1
-0
ansi-sequence-and-unicode
spec/fixtures/trace/ansi-sequence-and-unicode
+5
-0
stream_spec.rb
spec/lib/gitlab/ci/trace/stream_spec.rb
+21
-1
fixture_helpers.rb
spec/support/fixture_helpers.rb
+5
-2
No files found.
lib/gitlab/ci/trace/stream.rb
View file @
faa5dffb
...
...
@@ -30,6 +30,7 @@ module Gitlab
last_bytes
=
stream_size
end
stream
.
seek
(
-
last_bytes
,
IO
::
SEEK_END
)
stream
.
readline
end
def
append
(
data
,
offset
)
...
...
spec/fixtures/trace/ansi-sequence-and-unicode
0 → 100644
View file @
faa5dffb
[0m[01;34m.[0m
[30;42m..[0m
😺
ヾ(´༎ຶД༎ຶ`)ノ
[01;32m許功蓋[0m
spec/lib/gitlab/ci/trace/stream_spec.rb
View file @
faa5dffb
...
...
@@ -21,7 +21,7 @@ describe Gitlab::Ci::Trace::Stream do
end
end
it
'if size is larger we start from beg
gi
ning'
do
it
'if size is larger we start from beg
in
ning'
do
stream
.
limit
(
10
)
expect
(
stream
.
tell
).
to
eq
(
0
)
...
...
@@ -32,6 +32,26 @@ describe Gitlab::Ci::Trace::Stream do
expect
(
stream
.
tell
).
to
eq
(
6
)
end
context
'when the trace contains ANSI sequence and Unicode'
do
let
(
:stream
)
do
described_class
.
new
do
File
.
open
(
expand_fixture_path
(
'trace/ansi-sequence-and-unicode'
))
end
end
it
'forwards to the next linefeed, case 1'
do
stream
.
limit
(
7
)
expect
(
stream
.
raw
).
to
eq
(
''
)
end
it
'forwards to the next linefeed, case 2'
do
stream
.
limit
(
29
)
expect
(
stream
.
raw
).
to
eq
(
"
\e
[01;32m許功蓋
\e
[0m
\n
"
)
end
end
end
describe
'#append'
do
...
...
spec/support/fixture_helpers.rb
View file @
faa5dffb
module
FixtureHelpers
def
fixture_file
(
filename
)
return
''
if
filename
.
blank?
file_path
=
File
.
expand_path
(
Rails
.
root
.
join
(
'spec/fixtures/'
,
filename
))
File
.
read
(
file_path
)
File
.
read
(
expand_fixture_path
(
filename
))
end
def
expand_fixture_path
(
filename
)
File
.
expand_path
(
Rails
.
root
.
join
(
'spec/fixtures/'
,
filename
))
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