wrapDockerCliWithStreams wraps the Docker CLI to intercept and override stream methods
(baseCli command.Cli)
| 282 | |
| 283 | // wrapDockerCliWithStreams wraps the Docker CLI to intercept and override stream methods |
| 284 | func (s *composeService) wrapDockerCliWithStreams(baseCli command.Cli) command.Cli { |
| 285 | wrapper := &streamOverrideWrapper{ |
| 286 | Cli: baseCli, |
| 287 | } |
| 288 | |
| 289 | // Wrap custom streams in Docker CLI's stream types |
| 290 | if s.outStream != nil { |
| 291 | wrapper.outStream = streams.NewOut(s.outStream) |
| 292 | } |
| 293 | if s.errStream != nil { |
| 294 | wrapper.errStream = streams.NewOut(s.errStream) |
| 295 | } |
| 296 | if s.inStream != nil { |
| 297 | wrapper.inStream = streams.NewIn(&readCloserAdapter{r: s.inStream}) |
| 298 | } |
| 299 | |
| 300 | return wrapper |
| 301 | } |
| 302 | |
| 303 | // streamOverrideWrapper wraps command.Cli to override streams with custom implementations |
| 304 | type streamOverrideWrapper struct { |