diff options
author | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-18 01:44:15 +0900 |
---|---|---|
committer | Shinya Maeda <gitlab.shinyamaeda@gmail.com> | 2017-05-24 20:10:14 +0900 |
commit | 72b0af2c4cefea51c521d3606a0a3307aee41348 (patch) | |
tree | 455b20fdff92e590f47b5207dce18a6c3e91502e /lib | |
parent | fdcd2f192dd37ac2a2ea5b73926122009fbbe0aa (diff) | |
download | gitlab-ce-72b0af2c4cefea51c521d3606a0a3307aee41348.tar.gz |
Avoid tap. Use unless&empty.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/ci/trace/stream.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb index 39826846be0..d64c43df1d5 100644 --- a/lib/gitlab/ci/trace/stream.rb +++ b/lib/gitlab/ci/trace/stream.rb @@ -103,16 +103,14 @@ module Gitlab while (read_size = calc_read_size(pos, max)) > 0 pos += read_size stream.seek(-pos, IO::SEEK_END) - stream.read(read_size).tap do |buf| - buf = buf + debris - debris, *lines = buf.each_line.to_a - lines.reverse_each do |line| - yield(line) - end + buf = stream.read(read_size) + debris + debris, *lines = buf.each_line.to_a + lines.reverse_each do |line| + yield(line) end end - yield(debris) if debris != '' + yield(debris) unless debris.empty? end def calc_read_size(pos, max) |