Skip to content

Commit

Permalink
use tty mode only if terminal is available
Browse files Browse the repository at this point in the history
  • Loading branch information
bonifaido committed May 28, 2021
1 parent b772230 commit 91f1459
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kurun.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,14 @@ var runCmd = &cobra.Command{
return err
}

mode := "-i"
if fileInfo, _ := os.Stdout.Stat(); (fileInfo.Mode() & os.ModeCharDevice) != 0 {
mode += "t"
}

kubectlArgs := []string{
"run", strings.Split(image, ":")[0],
"-it",
mode,
"--image=docker.io/library/" + image,
"--quiet",
"--image-pull-policy=IfNotPresent",
Expand Down

0 comments on commit 91f1459

Please sign in to comment.