aboutsummaryrefslogtreecommitdiffhomepage
path: root/cmd/mbf
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-11-23 19:07:39 +0900
committerOphestra <cat@gensokyo.uk>2026-11-23 19:07:39 +0900
commitd58c561a067bf55449d82e3297062f2b80547089 (patch)
tree570f64e365c510e61a3365a5074d3b1448a3d955 /cmd/mbf
parentca6d417715000d25439e7c46403267b6e3723036 (diff)
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 <cat@gensokyo.uk>
Diffstat (limited to 'cmd/mbf')
-rw-r--r--cmd/mbf/cache.go28
1 files changed, 19 insertions, 9 deletions
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)")
}
}()
}