Allow launch-cluster.sh to be executed in non-TTY environment

This commit is contained in:
Eugene Rakhmatulin
2025-12-18 23:02:58 -08:00
parent 8c53179cc2
commit 2a2f8f24e2

View File

@@ -415,7 +415,15 @@ wait_for_cluster() {
if [[ "$ACTION" == "exec" ]]; then if [[ "$ACTION" == "exec" ]]; then
start_cluster start_cluster
echo "Executing command on head node: $COMMAND_TO_RUN" echo "Executing command on head node: $COMMAND_TO_RUN"
docker exec -it "$CONTAINER_NAME" bash -i -c "$COMMAND_TO_RUN"
# Check if running in a TTY to avoid "input device is not a TTY" error
if [ -t 0 ]; then
DOCKER_EXEC_FLAGS="-it"
else
DOCKER_EXEC_FLAGS="-i"
fi
docker exec $DOCKER_EXEC_FLAGS "$CONTAINER_NAME" bash -i -c "$COMMAND_TO_RUN"
elif [[ "$ACTION" == "start" ]]; then elif [[ "$ACTION" == "start" ]]; then
start_cluster start_cluster
if [[ "$DAEMON_MODE" == "true" ]]; then if [[ "$DAEMON_MODE" == "true" ]]; then