summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDaniel J Walsh <dwalsh@redhat.com>2021-03-18 06:33:25 -0400
committerMatthew Heon <mheon@redhat.com>2021-03-29 13:23:14 -0400
commit88672b58cfb9aed09b461cfd040472fdc3f867d9 (patch)
tree9b8ceb607bc6bb98da7db8f417c999ffbea5ce6c /test
parent23f3805df253a6144a7d6891628b6da533a8ecc0 (diff)
downloadpodman-88672b58cfb9aed09b461cfd040472fdc3f867d9.tar.gz
podman-88672b58cfb9aed09b461cfd040472fdc3f867d9.tar.bz2
podman-88672b58cfb9aed09b461cfd040472fdc3f867d9.zip
Check if stdin is a term in --interactive --tty mode
If you are attempting to run a container in interactive mode, and want a --tty, then there must be a terminal in use. Docker exits right away when a user specifies to use a --interactive and --TTY but the stdin is not a tty. Currently podman will pull the image and then fail much later. Podman will continue to run but will print an warning message. Discussion in : https://github.com/containers/podman/issues/8916 Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'test')
-rw-r--r--test/system/030-run.bats11
1 files changed, 11 insertions, 0 deletions
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