Skip to content

Commit

Permalink
ignore ctrl/cmd + c
Browse files Browse the repository at this point in the history
  • Loading branch information
CodaBool committed Oct 6, 2023
1 parent 1967448 commit 6a1610f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ import (
"fmt"
"os"
"os/exec"
"os/signal"
"strings"
"syscall"

"github.com/AlecAivazis/survey/v2"
"github.com/aws/aws-sdk-go-v2/config"
Expand Down Expand Up @@ -99,6 +101,17 @@ func main() {
c.Stdin = os.Stdin
c.Stdout = os.Stdout
c.Stderr = os.Stderr

// ignore ctrl + c
signalCh := make(chan os.Signal, 1)
signal.Notify(signalCh, os.Interrupt, syscall.SIGINT)

go func() {
for range signalCh {
fmt.Println("Ctrl+C is disabled during the SSM session. Use 'exit' to terminate the session.")
}
}()

c.Run()

term, err := client.TerminateSession(context.TODO(), &ssm.TerminateSessionInput{
Expand Down

0 comments on commit 6a1610f

Please sign in to comment.