summaryrefslogtreecommitdiff
path: root/lib/streamio
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@lukeshu.com>2023-04-13 02:42:56 -0600
committerLuke Shumaker <lukeshu@lukeshu.com>2023-04-13 08:19:01 -0600
commitf4d10a92abc46bf0156ff1b475304471c16405da (patch)
tree1c7dd77840d8b0851b58d4a1faf90ccd0da1805a /lib/streamio
parentb35aa24d868637332c1ba804a12911445a5a664b (diff)
Try to find misuses of textui.Progress
- Add a runtime-check to Progress to notice if we deadlocked or forgot to call .Done(). - Add a runtime-check to Progress.Done() to panic if .Set() was never called (instead of the old behavior of deadlocking). - grep: Use `defer` when possible, to help remember to call .Done(). - grep: Always either call .Set() right away, or right before calling .Done().
Diffstat (limited to 'lib/streamio')
-rw-r--r--lib/streamio/runescanner.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/streamio/runescanner.go b/lib/streamio/runescanner.go
index 203439f..1206522 100644
--- a/lib/streamio/runescanner.go
+++ b/lib/streamio/runescanner.go
@@ -103,6 +103,7 @@ func (rs *runeScanner) UnreadRune() error {
// ReadRune implements io.Closer.
func (rs *runeScanner) Close() error {
+ rs.progressWriter.Set(rs.progress)
rs.progressWriter.Done()
return rs.closer.Close()
}