(ctx context.Context, container string)
| 137 | } |
| 138 | |
| 139 | func (s *composeService) getContainerStreams(ctx context.Context, container string) (io.ReadCloser, error) { |
| 140 | cnx, err := s.apiClient().ContainerAttach(ctx, container, client.ContainerAttachOptions{ |
| 141 | Stream: true, |
| 142 | Stdin: false, |
| 143 | Stdout: true, |
| 144 | Stderr: true, |
| 145 | Logs: false, |
| 146 | }) |
| 147 | if err == nil { |
| 148 | stdout := ContainerStdout{HijackedResponse: cnx.HijackedResponse} |
| 149 | return stdout, nil |
| 150 | } |
| 151 | |
| 152 | // Fallback to logs API |
| 153 | logs, err := s.apiClient().ContainerLogs(ctx, container, client.ContainerLogsOptions{ |
| 154 | ShowStdout: true, |
| 155 | ShowStderr: true, |
| 156 | Follow: true, |
| 157 | }) |
| 158 | if err != nil { |
| 159 | return nil, err |
| 160 | } |
| 161 | return logs, nil |
| 162 | } |
no test coverage detected