refactor(attach): remove unused stdin from getContainerStream

Signed-off-by: hiroto.toyoda <hiroto.toyoda@dena.com>
This commit is contained in:
hiroto.toyoda
2026-01-06 21:05:08 +09:00
committed by Nicolas De loof
parent 79d7a8acd6
commit d7bdb34ff5

View File

@@ -102,7 +102,7 @@ func (s *composeService) doAttachContainer(ctx context.Context, service, id, nam
}
func (s *composeService) attachContainerStreams(ctx context.Context, container string, tty bool, stdout, stderr io.WriteCloser) error {
_, streamOut, err := s.getContainerStreams(ctx, container)
streamOut, err := s.getContainerStreams(ctx, container)
if err != nil {
return err
}
@@ -135,19 +135,17 @@ func (s *composeService) attachContainerStreams(ctx context.Context, container s
return nil
}
func (s *composeService) getContainerStreams(ctx context.Context, container string) (io.WriteCloser, io.ReadCloser, error) {
func (s *composeService) getContainerStreams(ctx context.Context, container string) (io.ReadCloser, error) {
cnx, err := s.apiClient().ContainerAttach(ctx, container, containerType.AttachOptions{
Stream: true,
Stdin: true,
Stdout: true,
Stderr: true,
Logs: false,
DetachKeys: s.configFile().DetachKeys,
Stream: true,
Stdin: false,
Stdout: true,
Stderr: true,
Logs: false,
})
if err == nil {
stdout := ContainerStdout{HijackedResponse: cnx}
stdin := ContainerStdin{HijackedResponse: cnx}
return stdin, stdout, nil
return stdout, nil
}
// Fallback to logs API
@@ -157,7 +155,7 @@ func (s *composeService) getContainerStreams(ctx context.Context, container stri
Follow: true,
})
if err != nil {
return nil, nil, err
return nil, err
}
return nil, logs, nil
return logs, nil
}