From 1a5eaa6f47c937ba88bc4314f9c6ab83c65d5754 Mon Sep 17 00:00:00 2001 From: "brian m. carlson" Date: Mon, 23 Sep 2019 21:44:00 +0000 Subject: [PATCH] docker: run interactively only if we have a TTY When building packages in containers, we pass options to docker. However, when running in a noninteractive environment such as GitHub Actions, we can't use the -i option, since standard input will not be a TTY and docker will consequently fail. Check for a TTY and pass the -i option only if one is present. --- docker/run_dockers.bsh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/docker/run_dockers.bsh b/docker/run_dockers.bsh index 2538e188..12c7395e 100755 --- a/docker/run_dockers.bsh +++ b/docker/run_dockers.bsh @@ -69,7 +69,11 @@ for IMAGE_NAME in "${IMAGES[@]}"; do fi #It CAN'T be empty () with set -u... So I put some defaults in here - OTHER_OPTIONS=("-it") + OTHER_OPTIONS=("-t") + + if tty >/dev/null; then + OTHER_OPTIONS+=("-i") + fi if [ "${AUTO_REMOVE-1}" == "1" ]; then OTHER_OPTIONS+=("--rm")