diff options
author | EuAndreh <eu@euandre.org> | 2025-05-05 07:55:26 -0300 |
---|---|---|
committer | EuAndreh <eu@euandre.org> | 2025-05-05 07:55:26 -0300 |
commit | edd033ec797b3d0f3cc6fcca87c3c513bb551314 (patch) | |
tree | 7e753ca9e0f01f03373d42874e6704a8cf00fdbf | |
parent | bin/muffle: Set $TMPDIR to $XDG_RUNTIME_DIR (diff) | |
download | dotfiles-edd033ec797b3d0f3cc6fcca87c3c513bb551314.tar.gz dotfiles-edd033ec797b3d0f3cc6fcca87c3c513bb551314.tar.xz |
bin/muffle: Replace ad-hoc status file logic with statusf(1)
-rwxr-xr-x | bin/muffle | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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 |