Make various goroutines panic-safe

This commit is contained in:
Kovid Goyal
2025-10-09 07:17:53 +05:30
parent 49d8b1a9d0
commit f067e9cd92
11 changed files with 69 additions and 22 deletions

View File

@@ -110,11 +110,13 @@ func marks_for_query(query string) (ans mark_set) {
prefixes := strings.Split(strings.ToLower(query), " ")
results := make(chan mark_set, len(prefixes))
ctx := images.Context{}
ctx.Parallel(0, len(prefixes), func(nums <-chan int) {
if err := ctx.SafeParallel(0, len(prefixes), func(nums <-chan int) {
for i := range nums {
results <- find_matching_codepoints(prefixes[i])
}
})
}); err != nil {
panic(err)
}
close(results)
for x := range results {
if ans == nil {