From d58c561a067bf55449d82e3297062f2b80547089 Mon Sep 17 00:00:00 2001 From: Ophestra Date: Mon, 23 Nov 2026 19:07:39 +0900 Subject: pkg: notify nature of exit This change breaks API. It is seen as an acceptable tradeoff here since this field has no known users other than cmd/mbf, and maintaining compatibility is very ugly in this case. Signed-off-by: Ophestra --- cmd/mbf/cache.go | 28 +++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) (limited to 'cmd') diff --git a/cmd/mbf/cache.go b/cmd/mbf/cache.go index 166e1c45..156a6834 100644 --- a/cmd/mbf/cache.go +++ b/cmd/mbf/cache.go @@ -72,7 +72,7 @@ func (cache *cache) open() (err error) { } else if base, err = check.NewAbs(cache.base); err != nil { return } - var notify chan bool + var notify chan int if cache.idle { cache.attr.Flags |= pkg.CSchedIdle @@ -88,7 +88,7 @@ func (cache *cache) open() (err error) { } if cache.color { cache.attr.Flags |= pkg.CColourOutput - notify = make(chan bool, 1<<12) + notify = make(chan int, 1<<12) cache.attr.Notify = notify } @@ -141,22 +141,32 @@ func (cache *cache) open() (err error) { prefix := hostname + ": mbf " go func() { - var n, nc uint64 - for enter := range notify { - if enter { - nc++ - } else { + var n, nf, nc uint64 + for kind := range notify { + switch kind { + case pkg.NExit: nc-- n++ + break + + case pkg.NEnter: + nc++ + break + + case pkg.NFault: + nc-- + nf++ + break } - if nc == 0 { + if nf == 0 && nc == 0 { writeTitle(cache.msg, prefix[:len(prefix)-1]) continue } writeTitle(cache.msg, prefix+ "("+strconv.FormatUint(nc, 10)+ - " running, "+strconv.FormatUint(n, 10)+" complete)") + " running, "+strconv.FormatUint(n, 10)+" complete, "+ + strconv.FormatUint(nf, 10)+" fault)") } }() } -- cgit v1.3.1