Skip to content

Commit ed5bc5e

Browse files
author
Jhon Wang
committed
patch containers#587: cmd/run: Add flag --no-tty/-T
1 parent a058308 commit ed5bc5e

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/cmd/run.go

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ var (
3434
runFlags struct {
3535
container string
3636
release string
37+
noTty bool
3738
}
3839
)
3940

@@ -53,6 +54,12 @@ func init() {
5354
"",
5455
"Run command inside a toolbox container with the given name.")
5556

57+
flags.BoolVarP(&runFlags.noTty,
58+
"no-tty",
59+
"T",
60+
false,
61+
"Run command without allocating a pseudo-TTY.")
62+
5663
flags.StringVarP(&runFlags.release,
5764
"release",
5865
"r",
@@ -293,11 +300,14 @@ func runCommand(container string,
293300

294301
execArgs = append(execArgs, []string{
295302
"--interactive",
296-
"--tty",
297303
"--user", currentUser.Username,
298304
"--workdir", workingDirectory,
299305
}...)
300306

307+
if !runFlags.noTty {
308+
execArgs = append(execArgs, "--tty")
309+
}
310+
301311
execArgs = append(execArgs, envOptions...)
302312

303313
execArgs = append(execArgs, []string{

0 commit comments

Comments
 (0)