Skip to content

Commit

Permalink
Merge pull request #380 from replicatedhq/divolgin/cursor
Browse files Browse the repository at this point in the history
Make cursors visible on CTRL+C
  • Loading branch information
divolgin committed Jul 1, 2021
2 parents 3382d29 + 4047977 commit 972fe2c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions cmd/preflight/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"io/ioutil"
"net/http"
"os"
"os/signal"
"strings"
"time"

Expand All @@ -28,6 +29,14 @@ func runPreflights(v *viper.Viper, arg string) error {
fmt.Print(cursor.Hide())
defer fmt.Print(cursor.Show())

go func() {
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt)
<-signalChan
fmt.Print(cursor.Show())
os.Exit(0)
}()

var preflightContent []byte
var err error
if strings.HasPrefix(arg, "secret/") {
Expand Down
9 changes: 9 additions & 0 deletions cmd/troubleshoot/cli/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"os/signal"

"net/url"
"os"
Expand Down Expand Up @@ -33,6 +34,14 @@ func runTroubleshoot(v *viper.Viper, arg string) error {
fmt.Print(cursor.Hide())
defer fmt.Print(cursor.Show())

go func() {
signalChan := make(chan os.Signal, 1)
signal.Notify(signalChan, os.Interrupt)
<-signalChan
fmt.Print(cursor.Show())
os.Exit(0)
}()

k8sConfig, err := k8sutil.GetRESTConfig()
if err != nil {
return errors.Wrap(err, "failed to convert kube flags to rest config")
Expand Down

0 comments on commit 972fe2c

Please sign in to comment.