aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuildos31
1 files changed, 25 insertions, 6 deletions
diff --git a/buildos b/buildos
index 52e984e..85d1d12 100755
--- a/buildos
+++ b/buildos
@@ -1159,14 +1159,15 @@ EOF
# hold space which by now should contain the last error line and
# then the cursor.
#
- # The last chunk matches every other line. We simply replace the
- # hold space with the next line so that at the end we have the
- # last line there.
+ # The last chunk matches every other line that doesn't start
+ # with a space (multi-line messages). We simply replace the hold
+ # space with the next line so that at the end we have the last
+ # line there.
#
lr="$("${c[@]}" --priority 4 --show-cursor | sed -n -r \
-e '1{h;s/^[MTWFS].. ([^ ]+ [^ ]+) .*$/\1/p;t}' \
-e '${x;s/^[MTWFS].. ([^ ]+ [^ ]+) .*$/\1/p;x;s/^-- cursor: (.+)$/\1/p;t}' \
--e 'h')"
+-e '/^[^ ]/h')"
lc="$(wc -l <<<"$lr")"
nc="$(sed -n -e "${lc}p" <<<"$lr")"
@@ -1193,7 +1194,25 @@ EOF
ed="$(date '+%s' -d "$ed")" # sec
ed="$(date '+%Y-%m-%d %H:%M:%S' -d "@$(($ed + 10))")" # +10sec
- s="bbot-agent-$tn@$i service issued new diagnostics"
+ # Include first fatal/error/warning (priority 2/3/4) in the
+ # subject line (note that there can be a mix so we have to
+ # try in the priority order).
+ #
+ p=2
+ s="$("${c[@]}" --output cat --priority 2 | head -n 1)"
+ if [ -z "$s" ]; then
+ p=3
+ s="$("${c[@]}" --output cat --priority 3 | head -n 1)"
+ if [ -z "$s" ]; then
+ p=4
+ s="$("${c[@]}" --output cat --priority 4 | head -n 1)"
+ if [ -z "$s" ]; then
+ s="service issued new diagnostics" # Shouldn't happen.
+ fi
+ fi
+ fi
+
+ s="bbot-agent-$tn@$i: $s"
info "$s"
{
@@ -1201,7 +1220,7 @@ EOF
echo;
echo "summary:";
echo;
- "${c[@]}" --priority 4 | head -n 200;
+ "${c[@]}" --priority "$p" | head -n 40;
echo;
echo "context:";
echo;