armbian-next: countdown: if to test -t 0 (0: stdin, 1:stdout) for interactive-ness; also test in if-not-aborted version
This commit is contained in:
parent
1a7877bb2e
commit
18c9946a4d
@ -8,7 +8,7 @@ function exit_if_countdown_not_aborted() {
|
||||
[[ -z "${reason}" ]] && exit_with_error "countdown_to_exit_or_just_exit_if_noninteractive() called without a reason"
|
||||
|
||||
# If not interactive, just exit.
|
||||
if [[ ! -t 1 ]]; then
|
||||
if [[ ! -t 0 ]]; then
|
||||
exit_with_error "Exiting due to '${reason}' - not interactive, exiting immediately."
|
||||
fi
|
||||
|
||||
@ -38,6 +38,12 @@ function countdown_and_continue_if_not_aborted() {
|
||||
# validate
|
||||
[[ -z "${loops}" ]] && exit_with_error "countdown_and_continue_if_not_aborted() called without a number of loops"
|
||||
|
||||
# If not interactive, just return 0.
|
||||
if [[ ! -t 0 ]]; then
|
||||
display_alert "not interactive" "continuing without countdown" "info"
|
||||
return 0
|
||||
fi
|
||||
|
||||
echo -n "Counting down: " >&2
|
||||
for i in $(seq 1 "${loops}"); do
|
||||
declare stop_waiting=0
|
||||
|
||||
Loading…
Reference in New Issue
Block a user