From a79a661aaa21e94abf42bbf8afb73e7504db73cc Mon Sep 17 00:00:00 2001 From: Balazs Andorko Date: Mon, 25 Sep 2023 01:15:36 +0200 Subject: [PATCH] fix: cursor disappeared in terminal after interrupt --- internal/cmd/main.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/cmd/main.go b/internal/cmd/main.go index f8af28d..53a05eb 100644 --- a/internal/cmd/main.go +++ b/internal/cmd/main.go @@ -11,6 +11,7 @@ import ( "context" "io" "os" + "os/signal" "path/filepath" "text/template" @@ -46,6 +47,15 @@ func main( initLogger(opts) + c := make(chan os.Signal, 1) + signal.Notify(c, os.Interrupt) + go func() { + for range c { + opts.spinner.Stop() + os.Exit(1) + } + }() + res := resolver.NewWithCacheDir(opts.dirs.http) cmd := filepath.Join(opts.dirs.bin, k6Binary)