Skip to content

Commit 5aea947

Browse files
gloursndeloof
andcommitted
Update comment on run command with tty & piped command
Co-authored-by: Nicolas De loof <[email protected]> Signed-off-by: Guillaume Lours <[email protected]>
1 parent d07c437 commit 5aea947

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

cmd/compose/run.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,10 @@ func runCommand(p *ProjectOptions, dockerCli command.Cli, backend api.Service) *
184184
options.noTty = !ttyFlag
185185
}
186186
} else if !cmd.Flags().Changed("no-TTY") && !cmd.Flags().Changed("interactive") && !dockerCli.In().IsTerminal() {
187-
// Check if the command was piped or not, if so, force noTty to tru
187+
// while `docker run` requires explicit `-it` flags, Compose enables interactive mode and TTY by default
188+
// but when compose is used from a scripr has stdin piped from another command, we just can't
189+
// Here, we detect we run "by default" (user didn't passed explicit flags) and disable TTY allocation if
190+
// we don't have an actual terminal to attach to for interactive mode
188191
options.noTty = true
189192
}
190193

0 commit comments

Comments
 (0)