From dd09e28d6efe5dde88f38743110d184b541a3b33 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dandelion=20Man=C3=A9?= Date: Fri, 27 Jul 2018 21:30:20 -0700 Subject: [PATCH] Make deploy script wait for valid response (#557) Currently, any non-yes keystroke causes the deply script to abort. This is frustrating, as it may take the user several minutes of waiting to get to the prompt, only to have the program inadvertently terminate. As of this change, the deploys script patiently re-prompts until it gets a valid input. Paired with @wchargin. Test plan: Ran locally and tested the yes, no, and invalid response cases. Also ran the script through shellcheck. --- scripts/deploy.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/deploy.sh b/scripts/deploy.sh index c02d9ee..1b5b9e9 100755 --- a/scripts/deploy.sh +++ b/scripts/deploy.sh @@ -121,8 +121,11 @@ build_and_deploy() { printf '\n' printf 'Please review the build output now---run:\n' printf ' cd "%s" && python -m SimpleHTTPServer\n' "${preview_dir}" - printf 'Do you want to deploy? yes/no> ' - read -r line + line= + while [ "${line}" != yes ] && [ "${line}" != no ]; do + printf 'Do you want to deploy? yes/no> ' + read -r line + done if [ "${line}" = yes ]; then ( set -x;