aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2025-05-05 07:55:26 -0300
committerEuAndreh <eu@euandre.org>2025-05-05 07:55:26 -0300
commitedd033ec797b3d0f3cc6fcca87c3c513bb551314 (patch)
tree7e753ca9e0f01f03373d42874e6704a8cf00fdbf
parentbin/muffle: Set $TMPDIR to $XDG_RUNTIME_DIR (diff)
downloaddotfiles-edd033ec797b3d0f3cc6fcca87c3c513bb551314.tar.gz
dotfiles-edd033ec797b3d0f3cc6fcca87c3c513bb551314.tar.xz
bin/muffle: Replace ad-hoc status file logic with statusf(1)
-rwxr-xr-xbin/muffle9
1 files changed, 4 insertions, 5 deletions
diff --git a/bin/muffle b/bin/muffle
index 86a537f..93ef48f 100755
--- a/bin/muffle
+++ b/bin/muffle
@@ -73,19 +73,18 @@ shift $((OPTIND - 1))
export TMPDIR="$XDG_RUNTIME_DIR"
OUT="$(mkstemp)"
ERR="$(mkstemp)"
-STATUS_F="$(mkstemp)"
-trap 'rm -f "$OUT" "$ERR" "$STATUS_F"' EXIT
+F="$(mkstemp)"
+trap 'rm -f "$OUT" "$ERR" "$F"' EXIT
timed() {
ts -s -m '%.s'
}
-echo 0 > "$STATUS_F"
{
- { "$@" || echo $? > "$STATUS_F"; } | pre -n out | timed > "$OUT"
+ statusf "$F" "$@" | pre -n out | timed > "$OUT"
} 2>&1 | pre -n err | timed > "$ERR"
-STATUS="$(cat "$STATUS_F")"
+STATUS="$(cat "$F")"
if [ "$INVERT" = false -a "$STATUS" != 0 ] || [ "$INVERT" = true -a "$STATUS" = 0 ]; then
sort -m "$OUT" "$ERR" | cut -d' ' -f2- | awk '{
print substr($0, length($1) + 2) > "/dev/std" $1