Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-06 11:38:56 +0300
committerShinya Maeda <gitlab.shinyamaeda@gmail.com>2017-05-24 14:10:14 +0300
commitddf67424ec5d84ff373e5e39195b5012c84eb920 (patch)
tree9983f0bad167088050b4fdac5a37f80011f87390 /lib/gitlab/ci
parent6018afa89fc34b0ea9ba691e3690a9837fadc122 (diff)
Fix while true
Diffstat (limited to 'lib/gitlab/ci')
-rw-r--r--lib/gitlab/ci/trace/stream.rb21
1 files changed, 8 insertions, 13 deletions
diff --git a/lib/gitlab/ci/trace/stream.rb b/lib/gitlab/ci/trace/stream.rb
index be8e40af016..72a0d669de0 100644
--- a/lib/gitlab/ci/trace/stream.rb
+++ b/lib/gitlab/ci/trace/stream.rb
@@ -117,23 +117,18 @@ module Gitlab
end
def reverse_line
- pos = 0
+ pos = BUFFER_SIZE
max = stream.size
- while true
+ while pos < max
+ stream.seek(-pos, IO::SEEK_END)
+ yield(stream.read(BUFFER_SIZE))
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
+
+ # Reached the head, read only left
+ stream.seek(0)
+ yield(stream.read(BUFFER_SIZE - (pos - max)))
end
end
end