Skip to content

Commit 2d87249

Browse files
committed
refactor(attach): remove unused stdin from getContainerStream
1 parent f622bce commit 2d87249

File tree

1 file changed

+10
-12
lines changed

1 file changed

+10
-12
lines changed

pkg/compose/attach.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func (s *composeService) doAttachContainer(ctx context.Context, service, id, nam
102102
}
103103

104104
func (s *composeService) attachContainerStreams(ctx context.Context, container string, tty bool, stdout, stderr io.WriteCloser) error {
105-
_, streamOut, err := s.getContainerStreams(ctx, container)
105+
streamOut, err := s.getContainerStreams(ctx, container)
106106
if err != nil {
107107
return err
108108
}
@@ -135,19 +135,17 @@ func (s *composeService) attachContainerStreams(ctx context.Context, container s
135135
return nil
136136
}
137137

138-
func (s *composeService) getContainerStreams(ctx context.Context, container string) (io.WriteCloser, io.ReadCloser, error) {
138+
func (s *composeService) getContainerStreams(ctx context.Context, container string) (io.ReadCloser, error) {
139139
cnx, err := s.apiClient().ContainerAttach(ctx, container, containerType.AttachOptions{
140-
Stream: true,
141-
Stdin: true,
142-
Stdout: true,
143-
Stderr: true,
144-
Logs: false,
145-
DetachKeys: s.configFile().DetachKeys,
140+
Stream: true,
141+
Stdin: false,
142+
Stdout: true,
143+
Stderr: true,
144+
Logs: false,
146145
})
147146
if err == nil {
148147
stdout := ContainerStdout{HijackedResponse: cnx}
149-
stdin := ContainerStdin{HijackedResponse: cnx}
150-
return stdin, stdout, nil
148+
return stdout, nil
151149
}
152150

153151
// Fallback to logs API
@@ -157,7 +155,7 @@ func (s *composeService) getContainerStreams(ctx context.Context, container stri
157155
Follow: true,
158156
})
159157
if err != nil {
160-
return nil, nil, err
158+
return nil, err
161159
}
162-
return nil, logs, nil
160+
return logs, nil
163161
}

0 commit comments

Comments
 (0)