1
0
mirror of https://github.com/pi-hole/pi-hole synced 2024-12-22 06:48:07 +00:00

This change fixes issue #145 "stty: standard input: Inappropriate ioctl for device ".It checks if a real terminal exist, if not it sets the screen size to a fixed value. This helps to avoid nasty and unnecessary logs when running "pihole -up" via e.g. cron.

Signed-off-by: B. Olausson <contactme@olausson.de>
This commit is contained in:
B. Olausson 2019-07-29 18:34:00 +02:00 committed by Dan Schaper
parent 97e11bd94e
commit ab1ea5a366
No known key found for this signature in database
GPG Key ID: B4FF14C01CC08DC0

View File

@ -84,8 +84,13 @@ if [ -z "${USER}" ]; then
fi
# Find the rows and columns will default to 80x24 if it can not be detected
screen_size=$(stty size || printf '%d %d' 24 80)
# Check if we are running on a real terminal and find the rows and columns
# If there is no real terminal, we will default to 80x24
if [ -t 0 ] ; then
screen_size=$(stty size)
else
screen_size="24 80"
fi
# Set rows variable to contain first number
printf -v rows '%d' "${screen_size%% *}"
# Set columns variable to contain second number