From 19ef236b7ad749b99eecf6fdc25dcb2088fc08b5 Mon Sep 17 00:00:00 2001 From: Alexandre Quercia Date: Sat, 20 Jan 2024 21:03:37 +0100 Subject: [PATCH] fix(test): execution without terminal Error: the input device is not a TTY --- tests/bin/test | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/bin/test b/tests/bin/test index be38ff188..5cfc67bfa 100755 --- a/tests/bin/test +++ b/tests/bin/test @@ -91,9 +91,11 @@ startDockerComposeServices () configureWithArguments () { + configureDockerComposeExecFlags + # Commands # - DOCKER_COMPOSE_EXEC="${DOCKER_COMPOSE} exec -u `id -u`:`id -g`" + DOCKER_COMPOSE_EXEC="${DOCKER_COMPOSE} exec ${dockerComposeExecFlags}" COMPOSER_UPDATE='composer update --working-dir=/app --prefer-dist --no-suggest --optimize-autoloader' # Default Options @@ -112,6 +114,30 @@ configureWithArguments () else :; fi } +configureDockerComposeExecFlags () +{ + dockerComposeExecFlags="-u `id -u`:`id -g`" + + if hasTty; then + : + else + dockerComposeExecFlags="${dockerComposeExecFlags} -T" + fi +} + +hasTty () +{ + test -t 0 || { + return 1 + } + + test -t 1 || { + return 1 + } + + return 0 +} + populatePHPVersions () { if test x'all' = x"${PHP_VERSIONS}"; then