pkg/bindings/containers: do not create sub slice

DemuxFrame() already returns a byte slice with the correct length so
this makes it simpler and the caller does not need to check this at all.

Signed-off-by: Paul Holzinger <pholzing@redhat.com>
This commit is contained in:
Paul Holzinger 2025-07-09 18:01:13 +02:00
parent f42453457c
commit ffec133766
No known key found for this signature in database
GPG Key ID: EB145DD938A3CAF2
1 changed files with 6 additions and 6 deletions

View File

@ -232,19 +232,19 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
switch fd {
case 0:
if isSet.stdout {
if _, err := stdout.Write(frame[0:l]); err != nil {
if _, err := stdout.Write(frame); err != nil {
return err
}
}
case 1:
if isSet.stdout {
if _, err := stdout.Write(frame[0:l]); err != nil {
if _, err := stdout.Write(frame); err != nil {
return err
}
}
case 2:
if isSet.stderr {
if _, err := stderr.Write(frame[0:l]); err != nil {
if _, err := stderr.Write(frame); err != nil {
return err
}
}
@ -555,19 +555,19 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, options *ExecStar
if options.GetAttachInput() {
// Write STDIN to STDOUT (echoing characters
// typed by another attach session)
if _, err := options.GetOutputStream().Write(frame[0:l]); err != nil {
if _, err := options.GetOutputStream().Write(frame); err != nil {
return err
}
}
case 1:
if options.GetAttachOutput() {
if _, err := options.GetOutputStream().Write(frame[0:l]); err != nil {
if _, err := options.GetOutputStream().Write(frame); err != nil {
return err
}
}
case 2:
if options.GetAttachError() {
if _, err := options.GetErrorStream().Write(frame[0:l]); err != nil {
if _, err := options.GetErrorStream().Write(frame); err != nil {
return err
}
}