1
0

build: docker run: make "-it" flags conditional on tty being available

from https://stackoverflow.com/a/69088164

I am trying to run the build.sh scripts directly on a cirrus CI runner, and "docker run -it" is erroring due to lack of a tty.
This commit is contained in:
SomberNight
2025-09-26 12:27:32 +00:00
parent daaf7b7c6b
commit b676c1e9d3
4 changed files with 26 additions and 5 deletions

View File

@@ -46,6 +46,12 @@ else
info "not doing fresh clone."
fi
DOCKER_RUN_FLAGS=""
if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
info "/dev/tty is available and usable"
DOCKER_RUN_FLAGS="-it"
fi
info "building binary..."
# check uid and maybe chown. see #8261
if [ ! -z "$ELECBUILD_COMMIT" ] ; then # fresh clone (reproducible build)
@@ -54,7 +60,7 @@ if [ ! -z "$ELECBUILD_COMMIT" ] ; then # fresh clone (reproducible build)
sudo chown -R 1000:1000 "$FRESH_CLONE"
fi
fi
docker run -it \
docker run $DOCKER_RUN_FLAGS \
--name electrum-sdist-builder-cont \
-v "$PROJECT_ROOT_OR_FRESHCLONE_ROOT":/opt/electrum \
--rm \