Skip to content

Commit b7fd6eb

Browse files
gloursndeloof
authored andcommitted
pass interactive flag to ExecOptions for the RunExec command
Signed-off-by: Guillaume Lours <[email protected]>
1 parent be187ba commit b7fd6eb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cmd/compose/exec.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,12 @@ type execOpts struct {
3535
environment []string
3636
workingDir string
3737

38-
noTty bool
39-
user string
40-
detach bool
41-
index int
42-
privileged bool
38+
noTty bool
39+
user string
40+
detach bool
41+
index int
42+
privileged bool
43+
interactive bool
4344
}
4445

4546
func execCommand(p *projectOptions, dockerCli command.Cli, backend api.Service) *cobra.Command {
@@ -71,7 +72,7 @@ func execCommand(p *projectOptions, dockerCli command.Cli, backend api.Service)
7172
runCmd.Flags().BoolVarP(&opts.noTty, "no-TTY", "T", !dockerCli.Out().IsTerminal(), "Disable pseudo-TTY allocation. By default `docker compose exec` allocates a TTY.")
7273
runCmd.Flags().StringVarP(&opts.workingDir, "workdir", "w", "", "Path to workdir directory for this command.")
7374

74-
runCmd.Flags().BoolP("interactive", "i", true, "Keep STDIN open even if not attached.")
75+
runCmd.Flags().BoolVarP(&opts.interactive, "interactive", "i", true, "Keep STDIN open even if not attached.")
7576
runCmd.Flags().MarkHidden("interactive") //nolint:errcheck
7677
runCmd.Flags().BoolP("tty", "t", true, "Allocate a pseudo-TTY.")
7778
runCmd.Flags().MarkHidden("tty") //nolint:errcheck
@@ -103,6 +104,7 @@ func runExec(ctx context.Context, backend api.Service, opts execOpts) error {
103104
Index: opts.index,
104105
Detach: opts.detach,
105106
WorkingDir: opts.workingDir,
107+
Interactive: opts.interactive,
106108
}
107109

108110
exitCode, err := backend.Exec(ctx, projectName, execOpts)

0 commit comments

Comments
 (0)