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
6018afa8
Commit
6018afa8
authored
May 06, 2017
by
Shinya Maeda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add reverse_line
parent
a1cddf05
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
1 deletion
+21
-1
lib/gitlab/ci/trace/stream.rb
lib/gitlab/ci/trace/stream.rb
+21
-1
No files found.
lib/gitlab/ci/trace/stream.rb
View file @
6018afa8
...
@@ -73,7 +73,7 @@ module Gitlab
...
@@ -73,7 +73,7 @@ module Gitlab
match
=
""
match
=
""
stream
.
each
_line
do
|
line
|
reverse
_line
do
|
line
|
matches
=
line
.
scan
(
regex
)
matches
=
line
.
scan
(
regex
)
next
unless
matches
.
is_a?
(
Array
)
next
unless
matches
.
is_a?
(
Array
)
next
if
matches
.
empty?
next
if
matches
.
empty?
...
@@ -115,6 +115,26 @@ module Gitlab
...
@@ -115,6 +115,26 @@ module Gitlab
chunks
.
join
.
lines
.
last
(
last_lines
).
join
chunks
.
join
.
lines
.
last
(
last_lines
).
join
end
end
def
reverse_line
pos
=
0
max
=
stream
.
size
while
true
pos
+=
BUFFER_SIZE
buf
=
if
pos
<=
max
stream
.
seek
(
-
pos
,
IO
::
SEEK_END
)
stream
.
read
(
BUFFER_SIZE
)
else
# Reached the head, read only left
stream
.
seek
(
0
)
stream
.
read
(
BUFFER_SIZE
-
(
pos
-
max
))
end
yield
(
buf
)
end
end
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