btrfs-progs: ci: check if docker run has a terminal

Using 'docker run -it' works for interactive sessions but not inside the
CI environment. We want both so make it optional by detecting if stdin
is a terminal.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2023-04-12 18:43:15 +02:00
parent cb0bf52edc
commit 5eb5ff2bdf

View File

@ -16,7 +16,13 @@ done
echo "ARGS: ${ARGS[@]}"
echo "RUN : $@"
# Running inside non-interactive terminal would fail
tty=
if [ -t 1 ]; then
tty=-it
fi
# Device mapper devices are not visible inside the environment if the /dev mount
# is the default one (tmpfs instead of devtmpfs)
# Mounts and loop device manipulation is required
docker run --mount type=bind,source=/dev,target=/dev -it --privileged "${ARGS[@]}" "$prefix/$image" "$@"
docker run --mount type=bind,source=/dev,target=/dev $tty --privileged "${ARGS[@]}" "$prefix/$image" "$@"