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.
This commit is contained in:
brian m. carlson 2019-09-23 21:44:00 +00:00
parent b1dad49a07
commit 1a5eaa6f47
No known key found for this signature in database
GPG Key ID: 2D0C9BC12F82B3A1

@ -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")