mirror of https://github.com/docker/compose.git
allow a TTY to be allocated with -t
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
parent
c15bf1955a
commit
e94eb056b4
|
@ -42,6 +42,7 @@ type runOptions struct {
|
||||||
Detach bool
|
Detach bool
|
||||||
Remove bool
|
Remove bool
|
||||||
noTty bool
|
noTty bool
|
||||||
|
tty bool
|
||||||
interactive bool
|
interactive bool
|
||||||
user string
|
user string
|
||||||
workdir string
|
workdir string
|
||||||
|
@ -133,6 +134,13 @@ func runCommand(p *ProjectOptions, streams api.Streams, backend api.Service) *co
|
||||||
}
|
}
|
||||||
opts.entrypointCmd = command
|
opts.entrypointCmd = command
|
||||||
}
|
}
|
||||||
|
if cmd.Flags().Changed("tty") {
|
||||||
|
if cmd.Flags().Changed("no-TTY") {
|
||||||
|
return fmt.Errorf("--tty and --no-TTY can't be used together")
|
||||||
|
} else {
|
||||||
|
opts.noTty = !opts.tty
|
||||||
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}),
|
}),
|
||||||
RunE: Adapt(func(ctx context.Context, args []string) error {
|
RunE: Adapt(func(ctx context.Context, args []string) error {
|
||||||
|
@ -165,7 +173,7 @@ func runCommand(p *ProjectOptions, streams api.Streams, backend api.Service) *co
|
||||||
flags.BoolVar(&createOpts.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file.")
|
flags.BoolVar(&createOpts.removeOrphans, "remove-orphans", false, "Remove containers for services not defined in the Compose file.")
|
||||||
|
|
||||||
cmd.Flags().BoolVarP(&opts.interactive, "interactive", "i", true, "Keep STDIN open even if not attached.")
|
cmd.Flags().BoolVarP(&opts.interactive, "interactive", "i", true, "Keep STDIN open even if not attached.")
|
||||||
cmd.Flags().BoolP("tty", "t", true, "Allocate a pseudo-TTY.")
|
cmd.Flags().BoolVarP(&opts.tty, "tty", "t", true, "Allocate a pseudo-TTY.")
|
||||||
cmd.Flags().MarkHidden("tty") //nolint:errcheck
|
cmd.Flags().MarkHidden("tty") //nolint:errcheck
|
||||||
|
|
||||||
flags.SetNormalizeFunc(normalizeRunFlags)
|
flags.SetNormalizeFunc(normalizeRunFlags)
|
||||||
|
|
Loading…
Reference in New Issue