Allow interrupting "w".
This commit is contained in:
parent
6368aa3446
commit
b064a0585b
@ -70,16 +70,22 @@ print_messages() {
|
||||
}
|
||||
|
||||
wait_for_messages() {
|
||||
tmp=0
|
||||
trap 'tmp=1' INT
|
||||
oldlength="${length}"
|
||||
while :; do
|
||||
length="$(get_message 1)"
|
||||
if [ "${oldlength}" -ne "${length}" ]; then
|
||||
break
|
||||
trap - INT
|
||||
return 0
|
||||
fi
|
||||
if [ "${tmp}" -eq 1 ]; then
|
||||
trap - INT
|
||||
return 1
|
||||
fi
|
||||
echo -n .
|
||||
sleep 1
|
||||
done
|
||||
echo
|
||||
}
|
||||
|
||||
length=0
|
||||
@ -103,11 +109,14 @@ while :; do
|
||||
echo "${length}"
|
||||
;;
|
||||
w)
|
||||
wait_for_messages
|
||||
wait_for_messages &&
|
||||
{
|
||||
echo
|
||||
print_messages "${length}"
|
||||
if [ -n "${DOBROHO_VECHORA_ON_WAIT}" ]; then
|
||||
${DOBROHO_VECHORA_ON_WAIT}
|
||||
fi
|
||||
}
|
||||
;;
|
||||
p)
|
||||
length="$(get_message 1)"
|
||||
|
Loading…
Reference in New Issue
Block a user