From 3c6d2ceb5905ad2a2c24a2443168e1dbeeaa5f2a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 8 May 2020 23:10:18 +0200 Subject: update-me: flush stdin before waiting for input --- update-me.in | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/update-me.in b/update-me.in index 7d12443..5b80572 100644 --- a/update-me.in +++ b/update-me.in @@ -73,6 +73,9 @@ opportunity_for_rescue_shell() { chown "${user}" "${safety_file}" fi >&2 printf '%s: waiting for clearance ...' "$(hostname)" + while read -t 0.0001; do + : + done while [ -f "${safety_file}" ] && [ "$(cat "${safety_file}")" = "$$" ]; do if read -t 1; then >&2 printf ' rescue shell!\n' @@ -92,6 +95,9 @@ exit_or_rescue_shell() { else >&2 printf '%s: Fehler\n' "$(hostname)" fi + while read -t 0.0001; do + : + done read s if [ -n "${s}" ]; then bash @@ -161,6 +167,9 @@ do err=$? while [ ${err} -ne 0 ]; do >&2 printf '%s (%s): Fehler - nochmal versuchen?\n' "$(hostname)" "${cmd}" + while read -t 0.0001; do + : + done read s if [ -n "${s}" ]; then break -- cgit v1.2.3-54-g00ecf