diff options
-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 |