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.
This commit is contained in:
Dandelion Mané 2018-07-27 21:30:20 -07:00 committed by GitHub
parent 81ccda773a
commit dd09e28d6e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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;