Skip to content

Commit 2a9729d

Browse files
committed
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 <[email protected]>
1 parent 173865e commit 2a9729d

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/bindings/containers/attach.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -232,19 +232,19 @@ func Attach(ctx context.Context, nameOrID string, stdin io.Reader, stdout io.Wri
232232
switch fd {
233233
case 0:
234234
if isSet.stdout {
235-
if _, err := stdout.Write(frame[0:l]); err != nil {
235+
if _, err := stdout.Write(frame); err != nil {
236236
return err
237237
}
238238
}
239239
case 1:
240240
if isSet.stdout {
241-
if _, err := stdout.Write(frame[0:l]); err != nil {
241+
if _, err := stdout.Write(frame); err != nil {
242242
return err
243243
}
244244
}
245245
case 2:
246246
if isSet.stderr {
247-
if _, err := stderr.Write(frame[0:l]); err != nil {
247+
if _, err := stderr.Write(frame); err != nil {
248248
return err
249249
}
250250
}
@@ -555,19 +555,19 @@ func ExecStartAndAttach(ctx context.Context, sessionID string, options *ExecStar
555555
if options.GetAttachInput() {
556556
// Write STDIN to STDOUT (echoing characters
557557
// typed by another attach session)
558-
if _, err := options.GetOutputStream().Write(frame[0:l]); err != nil {
558+
if _, err := options.GetOutputStream().Write(frame); err != nil {
559559
return err
560560
}
561561
}
562562
case 1:
563563
if options.GetAttachOutput() {
564-
if _, err := options.GetOutputStream().Write(frame[0:l]); err != nil {
564+
if _, err := options.GetOutputStream().Write(frame); err != nil {
565565
return err
566566
}
567567
}
568568
case 2:
569569
if options.GetAttachError() {
570-
if _, err := options.GetErrorStream().Write(frame[0:l]); err != nil {
570+
if _, err := options.GetErrorStream().Write(frame); err != nil {
571571
return err
572572
}
573573
}

0 commit comments

Comments
 (0)