awesome-client: simplify/fix ISATTY usage (#1151)

ISATTY was a bit confusing and can be replaced by `[ -t 0 ]`.

Followup to 4ce1608.
This commit is contained in:
Daniel Hahler 2016-10-09 22:36:03 +02:00 committed by GitHub
parent 2fb8492076
commit eb7aa511fb
1 changed files with 4 additions and 7 deletions

View File

@ -5,10 +5,7 @@
# when used with "|tail". # when used with "|tail".
set -o pipefail set -o pipefail
tty 2>&1 > /dev/null if [ -t 0 ] # is a tty.
ISATTY=$?
if [ "$ISATTY" = 0 ]
then then
# rlwrap provides readline functionality for "read", which is more enhanced # rlwrap provides readline functionality for "read", which is more enhanced
# than bash's "read" itself. # than bash's "read" itself.
@ -42,6 +39,7 @@ DBUS_PATH=/
DBUS_DEST=org.naquadah.awesome.awful DBUS_DEST=org.naquadah.awesome.awful
DBUS_METHOD=${DBUS_DEST}.Remote.Eval DBUS_METHOD=${DBUS_DEST}.Remote.Eval
FATAL_ERRORS=1
a_dbus_send() a_dbus_send()
{ {
$DBUS_SEND --dest=$DBUS_DEST --type=method_call --print-reply \ $DBUS_SEND --dest=$DBUS_DEST --type=method_call --print-reply \
@ -53,15 +51,14 @@ a_dbus_send()
fi fi
} }
FATAL_ERRORS="$ISATTY"
if [ $# -ne 0 ] if [ $# -ne 0 ]
then then
FATAL_ERRORS="1"
for arg in "$@" ; do for arg in "$@" ; do
a_dbus_send "$arg" a_dbus_send "$arg"
done done
elif [ "$ISATTY" = 0 ] elif [ -t 0 ]
then then
FATAL_ERRORS=0
while $READ_CMD -p "awesome# " -r line while $READ_CMD -p "awesome# " -r line
do do
if [ "$line" = "" ]; then if [ "$line" = "" ]; then