Skip to content

Commit

Permalink
Add timeout when asking whether to rebuild image (apache#17412)
Browse files Browse the repository at this point in the history
This PR adds timeout to answer the question, whether to rebuild
image when `breeze` is invoked or when pre-commit is run.

This reflects the typical use cases where rebuild is mostly not
needed, only in case of some tests which require new dependencies
to be included.

User has still 4 seconds to answer Y and have the images rebuilt
and just the presence of the question will be enough to get the
user trigger it from time to time.
  • Loading branch information
potiuk authored Aug 4, 2021
1 parent 2321020 commit 2938acd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions confirm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
set -euo pipefail
set -uo pipefail

if [[ -n "${FORCE_ANSWER_TO_QUESTIONS=}" ]]; then
RESPONSE=${FORCE_ANSWER_TO_QUESTIONS}
Expand All @@ -31,8 +31,8 @@ if [[ -n "${FORCE_ANSWER_TO_QUESTIONS=}" ]]; then
esac
else
echo
echo "Please confirm ${1}. Are you sure? [y/N/q]"
read -r RESPONSE
echo "Please confirm ${1} (or wait 4 seconds to skip it). Are you sure? [y/N/q]"
read -t 4 -r RESPONSE
fi

case "${RESPONSE}" in
Expand Down

0 comments on commit 2938acd

Please sign in to comment.