awesome-client: Handle errors when running arguments
Commit78abb4a54c
made awesome-client fail with a non-zero exit code when sending a command that it got from stdin failed. Commitf0f31bc305
added the possibility to specify commands to run as arguments to awesome-client. However, the exit code was still zero even when such a command failed. This commit makes awesome-client signal errors with its exit code even for code specified via arguments. Note that this means that following arguments will not be executed if some argument fails. I do not know if this is the best behaviour or not, but I am implementing it like this here due to its simplicity to implement. Signed-off-by: Uli Schlachter <psychon@znc.in>
This commit is contained in:
parent
08e4c304cd
commit
4ce16084ff
|
@ -44,14 +44,16 @@ a_dbus_send()
|
||||||
$DBUS_SEND --dest=$DBUS_DEST --type=method_call --print-reply \
|
$DBUS_SEND --dest=$DBUS_DEST --type=method_call --print-reply \
|
||||||
$DBUS_PATH $DBUS_METHOD string:"$1" | tail -n +2
|
$DBUS_PATH $DBUS_METHOD string:"$1" | tail -n +2
|
||||||
ret=$?
|
ret=$?
|
||||||
if [ "$ret" != 0 ] && [ "$ISATTY" != 0 ]; then
|
if [ "$ret" != 0 ] && [ "$FATAL_ERRORS" != 0 ]; then
|
||||||
echo "E: $DBUS_SEND failed." >&2
|
echo "E: $DBUS_SEND failed." >&2
|
||||||
exit $ret
|
exit $ret
|
||||||
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
|
||||||
|
|
Loading…
Reference in New Issue