fix: output of talosctl logs
might be corruped
The line was not copied properly, so sometimes `talosctl logs` output was garbled as the buffer was re-used. Signed-off-by: Andrey Smirnov <andrey.smirnov@talos-systems.com>
This commit is contained in:
parent
02f0a4526d
commit
289b41fe4b
@ -13,6 +13,7 @@ import (
|
||||
"sync"
|
||||
|
||||
criconstants "github.com/containerd/containerd/pkg/cri/constants"
|
||||
"github.com/siderolabs/gen/slices"
|
||||
"github.com/spf13/cobra"
|
||||
"google.golang.org/grpc/codes"
|
||||
|
||||
@ -134,11 +135,14 @@ func (slicer *lineSlicer) chopper(r io.Reader, hostname string) {
|
||||
scanner := bufio.NewScanner(r)
|
||||
|
||||
for scanner.Scan() {
|
||||
line := scanner.Bytes()
|
||||
line = slices.Copy(line, len(line))
|
||||
|
||||
slicer.respCh <- &common.Data{
|
||||
Metadata: &common.Metadata{
|
||||
Hostname: hostname,
|
||||
},
|
||||
Bytes: scanner.Bytes(),
|
||||
Bytes: line,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user