summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cmd/podman/containers/run.go6
-rw-r--r--contrib/tmpfile/podman.conf1
-rw-r--r--test/system/030-run.bats11
3 files changed, 18 insertions, 0 deletions
diff --git a/cmd/podman/containers/run.go b/cmd/podman/containers/run.go
index 83a5d7b8a..db7180ca9 100644
--- a/cmd/podman/containers/run.go
+++ b/cmd/podman/containers/run.go
@@ -17,6 +17,7 @@ import (
"github.com/pkg/errors"
"github.com/sirupsen/logrus"
"github.com/spf13/cobra"
+ "golang.org/x/crypto/ssh/terminal"
)
var (
@@ -106,6 +107,11 @@ func run(cmd *cobra.Command, args []string) error {
return err
}
+ // TODO: Breaking change should be made fatal in next major Release
+ if cliVals.TTY && cliVals.Interactive && !terminal.IsTerminal(int(os.Stdin.Fd())) {
+ logrus.Warnf("The input device is not a TTY. The --tty and --interactive flags might not work properly")
+ }
+
if af := cliVals.Authfile; len(af) > 0 {
if _, err := os.Stat(af); err != nil {
return err
diff --git a/contrib/tmpfile/podman.conf b/contrib/tmpfile/podman.conf
index e7cad4066..650678a21 100644
--- a/contrib/tmpfile/podman.conf
+++ b/contrib/tmpfile/podman.conf
@@ -1,5 +1,6 @@
# /tmp/podman-run-* directory can contain content for Podman containers that have run
# for many days. This following line prevents systemd from removing this content.
x /tmp/podman-run-*
+x /tmp/containers-user-*
D! /run/podman 0700 root root
D! /var/lib/cni/networks
diff --git a/test/system/030-run.bats b/test/system/030-run.bats
index b2999a9e7..39ade22af 100644
--- a/test/system/030-run.bats
+++ b/test/system/030-run.bats
@@ -668,4 +668,15 @@ json-file | f
is "$output" ".*HOME=/.*"
}
+@test "podman run --tty -i failure with no tty" {
+ run_podman run --tty -i --rm $IMAGE echo hello < /dev/null
+ is "$output" ".*The input device is not a TTY.*"
+
+ run_podman run --tty=false -i --rm $IMAGE echo hello < /dev/null
+ is "$output" "hello"
+
+ run_podman run --tty -i=false --rm $IMAGE echo hello < /dev/null
+ is "$output" "hello"
+}
+
# vim: filetype=sh