diff options
author | Paul Holzinger <paul.holzinger@web.de> | 2020-08-05 14:12:55 +0200 |
---|---|---|
committer | Valentin Rothberg <rothberg@redhat.com> | 2020-08-11 11:14:56 +0200 |
commit | d9c86fd0f2ea2d2587d470327192bd3d33875b2d (patch) | |
tree | 321845a48b82a07e943e73a5a4c0658d0eb1b808 /libpod | |
parent | dcf39f0abec6d8925b628904c96fa9d075669e29 (diff) | |
download | podman-d9c86fd0f2ea2d2587d470327192bd3d33875b2d.tar.gz podman-d9c86fd0f2ea2d2587d470327192bd3d33875b2d.tar.bz2 podman-d9c86fd0f2ea2d2587d470327192bd3d33875b2d.zip |
fix podman logs --tail when log is bigger than pagesize
Signed-off-by: Paul Holzinger <paul.holzinger@web.de>
Diffstat (limited to 'libpod')
-rw-r--r-- | libpod/logs/log.go | 12 | ||||
-rw-r--r-- | libpod/logs/reversereader/reversereader.go | 4 |
2 files changed, 8 insertions, 8 deletions
diff --git a/libpod/logs/log.go b/libpod/logs/log.go index 03acadb18..f66cbbadd 100644 --- a/libpod/logs/log.go +++ b/libpod/logs/log.go @@ -101,11 +101,14 @@ func getTailLog(path string, tail int) ([]*LogLine, error) { if err != nil { if errors.Cause(err) == io.EOF { inputs <- []string{leftover} - close(inputs) - break + } else { + logrus.Error(err) } - logrus.Error(err) close(inputs) + if err := f.Close(); err != nil { + logrus.Error(err) + } + break } line := strings.Split(s+leftover, "\n") if len(line) > 1 { @@ -136,9 +139,6 @@ func getTailLog(path string, tail int) ([]*LogLine, error) { } // if we have enough loglines, we can hangup if nllCounter >= tail { - if err := f.Close(); err != nil { - logrus.Error(err) - } break } } diff --git a/libpod/logs/reversereader/reversereader.go b/libpod/logs/reversereader/reversereader.go index 72d9ad975..4fa1a3f88 100644 --- a/libpod/logs/reversereader/reversereader.go +++ b/libpod/logs/reversereader/reversereader.go @@ -60,7 +60,7 @@ func (r *ReverseReader) Read() (string, error) { if int64(n) < r.readSize { b = b[0:n] } - // Set to the next page boundary - r.offset = -r.readSize + // Move the offset one pagesize up + r.offset -= r.readSize return string(b), nil } |