From: Michael Brown <supermathie@gmail.com> Date: Mon, 10 Jun 2019 17:24:22 +0000 (-0400) Subject: FIX: we cannot prompt for user input if we have no tty X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=623f10733874815348f603b3968082f169768487;p=discourse_docker.git FIX: we cannot prompt for user input if we have no tty --- diff --git a/launcher b/launcher index 8ef915c..6a71521 100755 --- a/launcher +++ b/launcher @@ -223,12 +223,14 @@ check_prereqs() { echo "You have less than 5GB of free space on the disk where $safe_folder is located. You will need more space to continue" df -h $safe_folder echo - read -p "Would you like to attempt to recover space by cleaning docker images and containers in the system?(y/N)" -n 1 -r - echo - if [[ $REPLY =~ ^[Yy]$ ]] - then - $docker_path system prune -af - echo "If the cleanup was successful, you may try again now" + if tty >/dev/null; then + read -p "Would you like to attempt to recover space by cleaning docker images and containers in the system?(y/N)" -n 1 -r + echo + if [[ $REPLY =~ ^[Yy]$ ]] + then + $docker_path system prune -af + echo "If the cleanup was successful, you may try again now" + fi fi exit 1 fi