Skip to content

Commit a2b9c81

Browse files
authored
Merge pull request docker#9246 from ndeloof/interactive
map --interactive to StdinOpen
2 parents d75f22c + 2282159 commit a2b9c81

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

cmd/compose/run.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ type runOptions struct {
4242
Detach bool
4343
Remove bool
4444
noTty bool
45+
interactive bool
4546
user string
4647
workdir string
4748
entrypoint string
@@ -158,9 +159,8 @@ func runCommand(p *projectOptions, backend api.Service) *cobra.Command {
158159
flags.BoolVar(&opts.servicePorts, "service-ports", false, "Run command with the service's ports enabled and mapped to the host.")
159160
flags.BoolVar(&opts.quietPull, "quiet-pull", false, "Pull without printing progress information.")
160161

161-
cmd.Flags().BoolP("interactive", "i", true, "Keep STDIN open even if not attached. DEPRECATED")
162-
cmd.Flags().MarkHidden("interactive") //nolint:errcheck
163-
cmd.Flags().BoolP("tty", "t", true, "Allocate a pseudo-TTY. DEPRECATED")
162+
cmd.Flags().BoolVarP(&opts.interactive, "interactive", "i", true, "Keep STDIN open even if not attached.")
163+
cmd.Flags().BoolP("tty", "t", true, "Allocate a pseudo-TTY.")
164164
cmd.Flags().MarkHidden("tty") //nolint:errcheck
165165

166166
flags.SetNormalizeFunc(normalizeRunFlags)
@@ -221,6 +221,14 @@ func runRun(ctx context.Context, backend api.Service, project *types.Project, op
221221
Index: 0,
222222
QuietPull: opts.quietPull,
223223
}
224+
225+
for i, service := range project.Services {
226+
if service.Name == opts.Service {
227+
service.StdinOpen = opts.interactive
228+
project.Services[i] = service
229+
}
230+
}
231+
224232
exitCode, err := backend.RunOneOffContainer(ctx, project, runOpts)
225233
if exitCode != 0 {
226234
errMsg := ""

0 commit comments

Comments
 (0)