selectEventProcessor picks the EventProcessor for Compose progress rendering. In auto mode we probe Err() (not Out()) because the renderer writes to stderr; probing stdout would force plain mode whenever stdout is redirected (e.g. `docker compose up | tee log`) while stderr is still a terminal.
(dockerCli command.Cli, progress, ansi string, detached bool)
| 645 | // probing stdout would force plain mode whenever stdout is redirected (e.g. |
| 646 | // `docker compose up | tee log`) while stderr is still a terminal. |
| 647 | func selectEventProcessor(dockerCli command.Cli, progress, ansi string, detached bool) (api.EventProcessor, error) { |
| 648 | switch progress { |
| 649 | case "", display.ModeAuto: |
| 650 | switch { |
| 651 | case ansi == "never": |
| 652 | display.Mode = display.ModePlain |
| 653 | return display.Plain(dockerCli.Err()), nil |
| 654 | case dockerCli.Err().IsTerminal(): |
| 655 | return display.Full(dockerCli.Err(), stdinfo(dockerCli), detached), nil |
| 656 | default: |
| 657 | return display.Plain(dockerCli.Err()), nil |
| 658 | } |
| 659 | case display.ModeTTY: |
| 660 | if ansi == "never" { |
| 661 | return nil, fmt.Errorf("can't use --progress tty while ANSI support is disabled") |
| 662 | } |
| 663 | display.Mode = display.ModeTTY |
| 664 | return display.Full(dockerCli.Err(), stdinfo(dockerCli), detached), nil |
| 665 | case display.ModePlain: |
| 666 | if ansi == "always" { |
| 667 | return nil, fmt.Errorf("can't use --progress plain while ANSI support is forced") |
| 668 | } |
| 669 | display.Mode = display.ModePlain |
| 670 | return display.Plain(dockerCli.Err()), nil |
| 671 | case display.ModeQuiet, "none": |
| 672 | display.Mode = display.ModeQuiet |
| 673 | return display.Quiet(), nil |
| 674 | case display.ModeJSON: |
| 675 | display.Mode = display.ModeJSON |
| 676 | logrus.SetFormatter(&logrus.JSONFormatter{}) |
| 677 | return display.JSON(dockerCli.Err()), nil |
| 678 | default: |
| 679 | return nil, fmt.Errorf("unsupported --progress value %q", progress) |
| 680 | } |
| 681 | } |
| 682 | |
| 683 | func setEnvWithDotEnv(opts ProjectOptions, dockerCli command.Cli) error { |
| 684 | // Check if we're using a remote config (OCI or Git) |