summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshutdownasap.in19
1 files changed, 16 insertions, 3 deletions
diff --git a/shutdownasap.in b/shutdownasap.in
index d131867..69c8d71 100755
--- a/shutdownasap.in
+++ b/shutdownasap.in
@@ -40,10 +40,23 @@ fi
echo $$ > "${tmpDir}/pid"
+capture_output() {
+ local exit_code
+ local output
+ output=$(
+ "$@" 2>&1 \
+ || exit_code=$?
+ )
+ if ! ${quiet}; then
+ printf '%s\n' "${output}"
+ fi
+ return ${exit_code}
+}
+
beforeWatchHook
i=1
-while [ ${i} -gt 0 ] || ! additionalWatchHookSlow
+while [ ${i} -gt 0 ] || ! cypture_output additionalWatchHookSlow
do
if [ ${i} -eq 0 ]
then
@@ -110,7 +123,7 @@ do
fi
done
- if ! additionalWatchHookFast
+ if ! cypture_output additionalWatchHookFast
then
nochwarten=true
if ! ${quiet}; then
@@ -133,7 +146,7 @@ do
i=$[${i}-1]
done
-beforeShutDownHook
+cypture_output beforeShutDownHook
if command -v sudo >/dev/null \
&& [ "$(whoami)" != 'root' ]; then