function block() {
local old=$(stty -g) in result REPLY;
# Disable cursor
tput civis
# Ensure it is reset
trap 'tput cnorm; stty sane "$old"' RETURN;
if [ "$1" = "" ]; then
# Disable echo
stty raw -echo
# Set Sleeper time to 5 seconds, if its not set
if [ "$sleeper_time" = "" ]; then
echo -n ' ' & sleep 5;
else
echo -n ' ' & sleep $sleeper_time;
fi;
"$@";
result=$?;
while read -t 0; do
IFS= read -rd '' -n1 && in+=$REPLY;
done;
printf %s "$in";
return $result
else
# "$@";
result=$?
IFS= read -rd '' -s _ && in+=$REPLY;
printf %s "$in";
return $result
fi;
}