Skip to content

Commit

Permalink
patch containers#587: cmd/run: Add flag --no-tty/-T
Browse files Browse the repository at this point in the history
  • Loading branch information
Jhon Wang committed Dec 26, 2020
1 parent a058308 commit ed5bc5e
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ var (
runFlags struct {
container string
release string
noTty bool
}
)

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

flags.BoolVarP(&runFlags.noTty,
"no-tty",
"T",
false,
"Run command without allocating a pseudo-TTY.")

flags.StringVarP(&runFlags.release,
"release",
"r",
Expand Down Expand Up @@ -293,11 +300,14 @@ func runCommand(container string,

execArgs = append(execArgs, []string{
"--interactive",
"--tty",
"--user", currentUser.Username,
"--workdir", workingDirectory,
}...)

if !runFlags.noTty {
execArgs = append(execArgs, "--tty")
}

execArgs = append(execArgs, envOptions...)

execArgs = append(execArgs, []string{
Expand Down

0 comments on commit ed5bc5e

Please sign in to comment.