diff --git a/cmd/fsck/main.go b/cmd/fsck/main.go index 9f0ea83a8..0827ea456 100644 --- a/cmd/fsck/main.go +++ b/cmd/fsck/main.go @@ -98,19 +98,19 @@ func main() { checkResult <- err close(checkResult) + cancel() // We're done, so we can exit. }() if *ui { if err := tui.RunApp(ctx, f); err != nil { slog.ErrorContext(ctx, "App exited", slog.Any("error", err)) } - // User may have exited the UI, cancel the context to signal to everything else. + // User may have exited the UI, cancel the context to signal to the async fsck process too. cancel() } else { for { select { case err := <-checkResult: - cancel() if err != nil { slog.ErrorContext(ctx, "fsck failed", slog.Any("error", err)) os.Exit(1)