From 23fa204e6921bb029d6c406c1b25948093e5b430 Mon Sep 17 00:00:00 2001 From: Nikos Tsipinakis Date: Fri, 10 Apr 2020 12:06:15 +0200 Subject: [PATCH] Use set -e --- dunstctl | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/dunstctl b/dunstctl index 48a6178..db481e5 100755 --- a/dunstctl +++ b/dunstctl @@ -1,6 +1,6 @@ #!/bin/sh -set -u +set -eu DBUS_NAME="org.freedesktop.Notifications" DBUS_PATH="/org/freedesktop/Notifications" @@ -28,13 +28,8 @@ show_help() { EOH } dbus_send_checked() { - dbus-send "$@" - rc="$?" - if [ "$rc" -eq "1" ]; then - echo "Failed to communicate with dunst, is it running? Or maybe the version is outdated." >&2 - echo "Hint: You can try 'dunstctl debug' as a next debugging step." >&2 - exit 1 - fi + dbus-send "$@" \ + || die "Failed to communicate with dunst, is it running? Or maybe the version is outdated. You can try 'dunstctl debug' as a next debugging step." } method_call() {