diff options
Diffstat (limited to 'cmd/mbf/main.go')
| -rw-r--r-- | cmd/mbf/main.go | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/cmd/mbf/main.go b/cmd/mbf/main.go index 68d418b5..0d44bdbc 100644 --- a/cmd/mbf/main.go +++ b/cmd/mbf/main.go @@ -136,7 +136,17 @@ func main() { c.NewCommand( "checksum", "Compute checksum of data read from standard input", func([]string) error { - go func() { <-ctx.Done(); os.Exit(1) }() + done := make(chan struct{}) + defer close(done) + go func() { + select { + case <-ctx.Done(): + os.Exit(1) + case <-done: + return + } + }() + h := sha512.New384() if _, err := io.Copy(h, os.Stdin); err != nil { return err |
